Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit d4a75d4

Browse files
committed
Support running tests in cluster from PhpStorm #77
- Covered remote PHP invocation with test
1 parent 6094a74 commit d4a75d4

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

docs/running-tests/running-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
It is possible to run Magento tests using remote PHP interpreter from the kubernetes cluster.
44

5-
1. Configure remote PHP interpreter in PhpStorm with credentials `root:123123q`. Use the IP which you get by running `minikube ip`
5+
1. Configure remote PHP interpreter in PhpStorm with credentials `root:123123q`. Use the IP which you get by running `minikube ip` and port `30022`
66
![](configure-remote-php.png)
77
1. Select configured remote PHP interpreter
88
![](select-remote-php.png)

tests/NoCustomConfigBasicTest.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function testNoCustomConfigBasic()
5858
assertMagentoEditionIsCE
5959
assertCeSampleDataNotInstalled
6060
assertRedisCacheIsEnabled
61+
assertRemotePhpWorks
6162
}
6263

6364
## Call and Run all Tests
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/expect -f
2+
3+
set timeout -1
4+
5+
spawn ssh root@magento.default -p 30022 -o "StrictHostKeyChecking no" -- 'php' '-i'
6+
7+
expect "root@magento.default's password: "
8+
9+
send "123123q\r"
10+
11+
expect eof

tests/include/assertions.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,3 +532,13 @@ function assertDevBoxContext()
532532

533533
assertTrue "Context switching does not work. Actual context: '$(getDevBoxContext)'; Expected context: '${context}'" '[[ $(getDevBoxContext) == ${context} ]]'
534534
}
535+
536+
function assertRemotePhpWorks()
537+
{
538+
echo "${blue}## assertRemotePhpWorks${regular}"
539+
echo "## assertRemotePhpWorks" >>${current_log_file_path}
540+
541+
remote_php_ini_contents="$(expect "${tests_dir}/_files/run_php_over_ssh_in_cluster.sh")"
542+
543+
assertTrue "Remote PHP is not accessible ('php -i' failed to execute over ssh)." '[[ ${remote_php_ini_contents} =~ "PHP License" ]]'
544+
}

0 commit comments

Comments
 (0)