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

Commit cfe69ef

Browse files
authored
Merge pull request #79 from magento/running-tests
Support running tests in cluster from PhpStorm #77
2 parents c39eaa8 + 6ee8f77 commit cfe69ef

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ install:
2929
# Download Helm
3030
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh && chmod +x get_helm.sh && sudo ${TRAVIS_BUILD_DIR}/get_helm.sh
3131
# Socat is required fo proper Helm operation
32-
- sudo apt-get update && sudo apt-get install -y socat
32+
- sudo apt-get update && sudo apt-get install -y socat expect
3333
# TODO Install sudo apt install nfs-kernel-server
3434
# - sudo apt install -y nfs-kernel-server
3535
- cat ${TRAVIS_BUILD_DIR}/etc/helm/values.yaml

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)