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

Commit 9a23e43

Browse files
committed
Support running tests in cluster from PhpStorm #77
- Added devbox tests which verify that it is possible to run Magento web API (GraphQL, REST, SOAP) tests over ssh
1 parent 241a81b commit 9a23e43

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

tests/MultiInstanceWithCeFromComposerNoNfsTest.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ function testMultiInstanceWithCeFromComposerNoNfs()
8383

8484
assertMagentoUnitTestsWork
8585
assertMagentoIntegrationTestsWork
86+
assertMagentoGraphQlTestsWork
87+
assertMagentoRestTestsWork
88+
assertMagentoSoapTestsWork
8689
}
8790

8891
## Call and Run all Tests

tests/include/assertions.sh

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,17 +561,47 @@ function assertMagentoUnitTestsWork()
561561
echo "${blue}## assertMagentoUnitTestsWork${regular}"
562562
echo "## assertMagentoUnitTestsWork" >>${current_log_file_path}
563563

564-
remote_unit_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/unit/phpunit.xml' --filter testGetAttributes '${devbox_dir}/$(getDevBoxContext)/vendor/magento/module-catalog/Test/Unit/Model/ProductTest.php'")"
564+
remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/unit/phpunit.xml' --filter testGetAttributes '${devbox_dir}/$(getDevBoxContext)/vendor/magento/module-catalog/Test/Unit/Model/ProductTest.php'")"
565565

566-
assertTrue "Unit tests are not configured properly (failed to run them over ssh)." '[[ ${remote_unit_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]'
566+
assertTrue "Unit tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]'
567567
}
568568

569569
function assertMagentoIntegrationTestsWork()
570570
{
571571
echo "${blue}## assertMagentoIntegrationTestsWork${regular}"
572572
echo "## assertMagentoIntegrationTestsWork" >>${current_log_file_path}
573573

574-
remote_integration_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/integration/phpunit.xml' --filter testGetAddressById '${devbox_dir}/$(getDevBoxContext)/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php'")"
574+
remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/integration/phpunit.xml' --filter testGetAddressById '${devbox_dir}/$(getDevBoxContext)/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php'")"
575575

576-
assertTrue "Integration tests are not configured properly (failed to run them over ssh)." '[[ ${remote_integration_test_execution_status} =~ "OK (2 tests, 3 assertions)" ]]'
576+
assertTrue "Integration tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (2 tests, 3 assertions)" ]]'
577+
}
578+
579+
function assertMagentoGraphQlTestsWork()
580+
{
581+
echo "${blue}## assertMagentoGraphQlTestsWork${regular}"
582+
echo "## assertMagentoGraphQlTestsWork" >>${current_log_file_path}
583+
584+
remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/phpunit_graphql.xml' --filter testUpdateCustomerIfInputDataIsEmpty '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php'")"
585+
586+
assertTrue "GraphQL tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]'
587+
}
588+
589+
function assertMagentoRestTestsWork()
590+
{
591+
echo "${blue}## assertMagentoRestTestsWork${regular}"
592+
echo "## assertMagentoRestTestsWork" >>${current_log_file_path}
593+
594+
remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/phpunit_rest.xml' --filter testGetForMyCart '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/CartRepositoryTest.php'")"
595+
596+
assertTrue "REST tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]'
597+
}
598+
599+
function assertMagentoSoapTestsWork()
600+
{
601+
echo "${blue}## assertMagentoSoapTestsWork${regular}"
602+
echo "## assertMagentoSoapTestsWork" >>${current_log_file_path}
603+
604+
remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/phpunit_soap.xml' --filter testCreateGroupWithIdSoap '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php'")"
605+
606+
assertTrue "SOAP tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 1 assertion)" ]]'
577607
}

0 commit comments

Comments
 (0)