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

Commit 803794c

Browse files
committed
Enabling additional test assertions for "No custom config" scenario
1 parent e0d0fae commit 803794c

File tree

6 files changed

+66
-48
lines changed

6 files changed

+66
-48
lines changed

scripts/host/configure_tests.sh

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,29 @@ if [[ ! -f "${magento_tests_root}/integration/phpunit.xml" ]] && [[ -f "${magent
4040
fi
4141

4242
# Web API tests (api-functional)
43-
if [[ ! -f "${magento_tests_root}/api-functional/rest.xml" ]] && [[ -f "${magento_tests_root}/api-functional/phpunit.xml.dist" ]]; then
43+
if [[ ! -f "${magento_tests_root}/api-functional/phpunit_rest.xml" ]] && [[ -f "${magento_tests_root}/api-functional/phpunit_rest.xml.dist" ]]; then
4444
status "Creating configuration for REST tests"
45-
cp "${magento_tests_root}/api-functional/phpunit.xml.dist" "${magento_tests_root}/api-functional/rest.xml"
46-
sed -i.back "s|http://magento.url|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/rest.xml"
47-
sed -i.back "s|http://magento-ee.localhost|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/rest.xml"
48-
sed -i.back "s|<const name=\"TESTS_CLEANUP\" value=\"enabled\"/>|<const name=\"TESTS_CLEANUP\" value=\"disabled\"/>|g" "${magento_tests_root}/api-functional/rest.xml"
49-
rm -f "${magento_tests_root}/api-functional/rest.xml.back"
45+
cp "${magento_tests_root}/api-functional/phpunit_rest.xml.dist" "${magento_tests_root}/api-functional/phpunit_rest.xml"
46+
sed -i.back "s|http://magento.url|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/phpunit_rest.xml"
47+
sed -i.back "s|http://magento-ee.localhost|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/phpunit_rest.xml"
48+
sed -i.back "s|<const name=\"TESTS_CLEANUP\" value=\"enabled\"/>|<const name=\"TESTS_CLEANUP\" value=\"disabled\"/>|g" "${magento_tests_root}/api-functional/phpunit_rest.xml"
49+
rm -f "${magento_tests_root}/api-functional/phpunit_rest.xml.back"
5050
fi
51-
if [[ ! -f "${magento_tests_root}/api-functional/soap.xml" ]] && [[ -f "${magento_tests_root}/api-functional/phpunit.xml.dist" ]]; then
51+
if [[ ! -f "${magento_tests_root}/api-functional/phpunit_soap.xml" ]] && [[ -f "${magento_tests_root}/api-functional/phpunit_soap.xml.dist" ]]; then
5252
status "Creating configuration for SOAP tests"
53-
cp "${magento_tests_root}/api-functional/phpunit.xml.dist" "${magento_tests_root}/api-functional/soap.xml"
54-
sed -i.back "s|http://magento.url|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/soap.xml"
55-
sed -i.back "s|http://magento-ee.localhost|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/soap.xml"
56-
sed -i.back "s|<const name=\"TESTS_WEB_API_ADAPTER\" value=\"rest\"/>|<const name=\"TESTS_WEB_API_ADAPTER\" value=\"soap\"/>|g" "${magento_tests_root}/api-functional/soap.xml"
57-
sed -i.back "s|<const name=\"TESTS_CLEANUP\" value=\"enabled\"/>|<const name=\"TESTS_CLEANUP\" value=\"disabled\"/>|g" "${magento_tests_root}/api-functional/soap.xml"
58-
rm -f "${magento_tests_root}/api-functional/soap.xml.back"
53+
cp "${magento_tests_root}/api-functional/phpunit_soap.xml.dist" "${magento_tests_root}/api-functional/phpunit_soap.xml"
54+
sed -i.back "s|http://magento.url|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/phpunit_soap.xml"
55+
sed -i.back "s|http://magento-ee.localhost|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/phpunit_soap.xml"
56+
sed -i.back "s|<const name=\"TESTS_CLEANUP\" value=\"enabled\"/>|<const name=\"TESTS_CLEANUP\" value=\"disabled\"/>|g" "${magento_tests_root}/api-functional/phpunit_soap.xml"
57+
rm -f "${magento_tests_root}/api-functional/phpunit_soap.xml.back"
58+
fi
59+
if [[ ! -f "${magento_tests_root}/api-functional/phpunit_graphql.xml" ]] && [[ -f "${magento_tests_root}/api-functional/phpunit_graphql.xml.dist" ]]; then
60+
status "Creating configuration for GraphQL tests"
61+
cp "${magento_tests_root}/api-functional/phpunit_graphql.xml.dist" "${magento_tests_root}/api-functional/phpunit_graphql.xml"
62+
sed -i.back "s|http://magento.url|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/phpunit_graphql.xml"
63+
sed -i.back "s|http://magento-ee.localhost|http://${magento_host_name}|g" "${magento_tests_root}/api-functional/phpunit_graphql.xml"
64+
sed -i.back "s|<const name=\"TESTS_CLEANUP\" value=\"enabled\"/>|<const name=\"TESTS_CLEANUP\" value=\"disabled\"/>|g" "${magento_tests_root}/api-functional/phpunit_graphql.xml"
65+
rm -f "${magento_tests_root}/api-functional/phpunit_graphql.xml.back"
5966
fi
6067

6168
# Functional tests
@@ -67,13 +74,16 @@ if [[ ! -f "${magento_tests_root}/functional/phpunit.xml" ]] && [[ -f "${magento
6774
sed -i.back "s|http://localhost|http://${magento_host_name}|g" "${magento_tests_root}/functional/phpunit.xml"
6875
# For Magento 2.2
6976
sed -i.back "s|http://127.0.0.1|http://${magento_host_name}|g" "${magento_tests_root}/functional/phpunit.xml"
77+
# For Magento 2.3
78+
sed -i.back "s|http://magento2ce.com/|http://${magento_host_name}|g" "${magento_tests_root}/functional/phpunit.xml"
79+
sed -i.back "s|http://magento2ee.com/|http://${magento_host_name}|g" "${magento_tests_root}/functional/phpunit.xml"
7080

7181
sed -i.back "s|/backend/|/${magento_admin_frontname}/|g" "${magento_tests_root}/functional/phpunit.xml"
7282
rm -f "${magento_tests_root}/functional/phpunit.xml.back"
7383

7484
if [[ ! -f "${magento_tests_root}/functional/etc/config.xml" ]] && [[ -f "${magento_tests_root}/functional/etc/config.xml.dist" ]]; then
7585
cp "${magento_tests_root}/functional/etc/config.xml.dist" "${magento_tests_root}/functional/etc/config.xml"
76-
sed -i.back "s|magento.com|${magento_host_name}|g" "${magento_tests_root}/functional/etc/config.xml"
86+
sed -i.back "s|http://magento2ce.com|http://${magento_host_name}|g" "${magento_tests_root}/functional/etc/config.xml"
7787
sed -i.back "s|admin/|${magento_admin_frontname}/|g" "${magento_tests_root}/functional/etc/config.xml"
7888
sed -i.back "s|<backendLogin>admin</backendLogin>|<backendLogin>${magento_admin_user}</backendLogin>|g" "${magento_tests_root}/functional/etc/config.xml"
7989
sed -i.back "s|<backendPassword>123123q</backendPassword>|<backendPassword>${magento_admin_password}</backendPassword>|g" "${magento_tests_root}/functional/etc/config.xml"

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Current project contains functional tests for [Kubernetes DevBox for Magento 2 D
66

77
1. Make sure that your host meets requirements listed [here](https://github.com/magento/magento2-kubernetes-devbox#requirements)
88
1. Copy [configuration.sh.dist](include/configuration.sh.dist) to `include/configuration.sh` and make necessary changes
9-
1. Copy [auth.json.dist](include/auth.json.dist) to `include/auth.json` and add valid keys
9+
1. Copy [auth.json.dist](include/auth.json.dist) to `include/auth.json` and add valid keys. This step is required only for testing of Composer-based installations
1010
1. Run [testsuite.sh](testsuite.sh) in bash

tests/include/assertions.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ function assertPhpStormConfigured()
276276
assertTrue 'PhpStorm was not configured (webServers.xml is missing)' '[[ -f "${vagrant_dir}/.idea/webServers.xml" ]]'
277277

278278
deployment_config_content="$(cat "${deployment_config_path}")"
279-
assertTrue 'PhpStorm configured incorrectly. deployment.xml config is invalid' '[[ ${deployment_config_content} =~ \$PROJECT_DIR\$/magento2ce/app/etc ]]'
279+
assertTrue 'PhpStorm configured incorrectly. deployment.xml config is invalid' '[[ ${deployment_config_content} =~ \$PROJECT_DIR\$/magento/app/etc ]]'
280280

281281
misc_config_content="$(cat "${misc_config_path}")"
282282
assertTrue 'PhpStorm configured incorrectly. misc.xml config is invalid' '[[ ${misc_config_content} =~ urn:magento:module:Magento_Cron:etc/crontab.xsd ]]'
@@ -403,40 +403,47 @@ function assertTestsConfigured()
403403
echo "## assertTestsConfigured" >>${current_log_file_path}
404404

405405
# Unit tests
406-
unit_tests_config_path="${vagrant_dir}/magento2ce/dev/tests/unit/phpunit.xml"
406+
unit_tests_config_path="${vagrant_dir}/magento/dev/tests/unit/phpunit.xml"
407407
assertTrue "Unit tests are not configured ('${unit_tests_config_path}' is missing)" '[[ -f ${unit_tests_config_path} ]]'
408408

409409
# Integration tests
410-
integration_tests_config_path="${vagrant_dir}/magento2ce/dev/tests/integration/phpunit.xml"
410+
integration_tests_config_path="${vagrant_dir}/magento/dev/tests/integration/phpunit.xml"
411411
assertTrue "Integration tests are not configured ('${integration_tests_config_path}' is missing)" '[[ -f ${integration_tests_config_path} ]]'
412-
integration_tests_mysql_config_path="${vagrant_dir}/magento2ce/dev/tests/integration/etc/install-config-mysql.php"
412+
integration_tests_mysql_config_path="${vagrant_dir}/magento/dev/tests/integration/etc/install-config-mysql.php"
413413
assertTrue "Integration tests MySQL config ('${integration_tests_mysql_config_path}') is missing" '[[ -f ${integration_tests_mysql_config_path} ]]'
414414
integration_tests_mysql_config_content="$(cat "${integration_tests_mysql_config_path}")"
415415
pattern="amqp-password"
416416
assertTrue "Contents of '${integration_tests_mysql_config_path}' seems to be invalid${functional_tests_config_content} =~ ${pattern}" '[[ ${integration_tests_mysql_config_content} =~ ${pattern} ]]'
417417

418418
# REST Web API tests
419-
rest_tests_config_path="${vagrant_dir}/magento2ce/dev/tests/api-functional/rest.xml"
419+
rest_tests_config_path="${vagrant_dir}/magento/dev/tests/api-functional/phpunit_rest.xml"
420420
assertTrue "REST tests are not configured ('${rest_tests_config_path}' is missing)" '[[ -f ${rest_tests_config_path} ]]'
421421
rest_tests_config_content="$(cat "${rest_tests_config_path}")"
422422
pattern="${current_magento_base_url}"
423423
assertTrue "Contents of '${rest_tests_config_path}' seems to be invalid ${rest_tests_config_content} =~ ${pattern}" '[[ ${rest_tests_config_content} =~ ${pattern} ]]'
424424

425425
# SOAP Web API tests
426-
soap_tests_config_path="${vagrant_dir}/magento2ce/dev/tests/api-functional/soap.xml"
426+
soap_tests_config_path="${vagrant_dir}/magento/dev/tests/api-functional/phpunit_soap.xml"
427427
assertTrue "SOAP tests are not configured ('${soap_tests_config_path}' is missing)" '[[ -f ${soap_tests_config_path} ]]'
428428
soap_tests_config_content="$(cat "${soap_tests_config_path}")"
429429
pattern="${current_magento_base_url}"
430430
assertTrue "Contents of '${soap_tests_config_path}' seems to be invalid ${soap_tests_config_content} =~ ${pattern}" '[[ ${soap_tests_config_content} =~ ${pattern} ]]'
431+
432+
# GraphQL Web API tests
433+
graphql_tests_config_path="${vagrant_dir}/magento/dev/tests/api-functional/phpunit_graphql.xml"
434+
assertTrue "GraphQL tests are not configured ('${graphql_tests_config_path}' is missing)" '[[ -f ${graphql_tests_config_path} ]]'
435+
graphql_tests_config_content="$(cat "${graphql_tests_config_path}")"
436+
pattern="${current_magento_base_url}"
437+
assertTrue "Contents of '${graphql_tests_config_path}' seems to be invalid ${graphql_tests_config_content} =~ ${pattern}" '[[ ${graphql_tests_config_content} =~ ${pattern} ]]'
431438

432439
# Functional tests
433-
functional_tests_config_path="${vagrant_dir}/magento2ce/dev/tests/functional/phpunit.xml"
440+
functional_tests_config_path="${vagrant_dir}/magento/dev/tests/functional/phpunit.xml"
434441
assertTrue "Functional tests are not configured ('${functional_tests_config_path}' is missing)" '[[ -f ${functional_tests_config_path} ]]'
435442
functional_tests_config_content="$(cat "${functional_tests_config_path}")"
436443
pattern="${current_magento_base_url}"
437444
assertTrue "Contents of '${functional_tests_config_path}' seems to be invalid ${functional_tests_config_content} =~ ${pattern}" '[[ ${functional_tests_config_content} =~ ${pattern} ]]'
438445

439-
functional_tests_config_path="${vagrant_dir}/magento2ce/dev/tests/functional/etc/config.xml"
446+
functional_tests_config_path="${vagrant_dir}/magento/dev/tests/functional/etc/config.xml"
440447
assertTrue "Functional tests are not configured ('${functional_tests_config_path}' is missing)" '[[ -f ${functional_tests_config_path} ]]'
441448
functional_tests_config_content="$(cat "${functional_tests_config_path}")"
442449
pattern="${current_magento_base_url}"
@@ -493,7 +500,7 @@ function assertRedisCacheIsEnabled()
493500
echo "${blue}## assertRedisCacheIsEnabled${regular}"
494501
echo "## assertRedisCacheIsEnabled" >>${current_log_file_path}
495502

496-
cache_directory="${vagrant_dir}/magento2ce/var/cache"
503+
cache_directory="${vagrant_dir}/magento/var/cache"
497504
assertFalse "Redis cache seems to be disabled since cache directory '${cache_directory}' was created." '[[ -d ${cache_directory} ]]'
498505
}
499506

@@ -502,6 +509,6 @@ function assertRedisCacheIsDisabled()
502509
echo "${blue}## assertRedisCacheIsDisabled${regular}"
503510
echo "## assertRedisCacheIsDisabled" >>${current_log_file_path}
504511

505-
cache_directory="${vagrant_dir}/magento2ce/var/cache"
512+
cache_directory="${vagrant_dir}/magento/var/cache"
506513
assertTrue "Redis cache seems to be enabled since cache directory '${cache_directory}' was not created." '[[ -d ${cache_directory} ]]'
507514
}

tests/include/configuration.sh.dist

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#! /usr/bin/env bash
22

3-
# Path to local copy of devbox project has higher priority over repository
43
original_dir="$(pwd)"
54

65
cd "$(dirname "${BASH_SOURCE[0]}")/../.." && project_root_dir=$PWD
6+
7+
# Path to local copy of devbox project has higher priority over repository. Comment out the next line to enable checkout from Git
78
vagrant_project_local_path="${project_root_dir}"
89

9-
vagrant_project_repository_url="git@github.com:paliarush/magento2-vagrant-for-developers.git"
10-
vagrant_project_branch="2.0"
10+
vagrant_project_repository_url="git@github.com:magento/magento2-vagrant-for-developers.git"
11+
vagrant_project_branch="master"
1112

1213
delete_test_project_on_tear_down=0
1314

tests/include/helpers.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,34 +107,34 @@ function deployVagrantProject()
107107

108108
function stashMagentoCodebase()
109109
{
110-
if [[ ${skip_codebase_stash} == 0 ]] && [[ -d "${vagrant_dir}/magento2ce" ]]; then
110+
if [[ ${skip_codebase_stash} == 0 ]] && [[ -d "${vagrant_dir}/magento" ]]; then
111111
echo "${grey}## stashMagentoCodebase${regular}"
112112
echo "## stashMagentoCodebase" >>${current_log_file_path}
113113
magento_stash_dir="${magento_codebase_stash_dir}/${current_codebase}"
114114
rm -rf "${magento_stash_dir}"
115115
mkdir -p "${magento_stash_dir}"
116-
mv "${vagrant_dir}/magento2ce" "${magento_stash_dir}/magento2ce"
117-
rm -rf "${magento_stash_dir}/magento2ce/var/*"
118-
rm -rf "${magento_stash_dir}/magento2ce/vendor/*"
119-
rm -rf "${magento_stash_dir}/magento2ce/pub/static/*"
120-
rm -f "${magento_stash_dir}/magento2ce/app/etc/config.php"
121-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/api-functional/soap.xml"
122-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/api-functional/rest.xml"
123-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/functional/phpunit.xml"
124-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/functional/etc/config.xml"
125-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/integration/phpunit.xml"
126-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/integration/etc/install-config-mysql.php"
127-
rm -f "${magento_stash_dir}/magento2ce/dev/tests/unit/phpunit.xml"
116+
mv "${vagrant_dir}/magento" "${magento_stash_dir}/magento"
117+
rm -rf "${magento_stash_dir}/magento/var/*"
118+
rm -rf "${magento_stash_dir}/magento/vendor/*"
119+
rm -rf "${magento_stash_dir}/magento/pub/static/*"
120+
rm -f "${magento_stash_dir}/magento/app/etc/config.php"
121+
rm -f "${magento_stash_dir}/magento/dev/tests/api-functional/soap.xml"
122+
rm -f "${magento_stash_dir}/magento/dev/tests/api-functional/rest.xml"
123+
rm -f "${magento_stash_dir}/magento/dev/tests/functional/phpunit.xml"
124+
rm -f "${magento_stash_dir}/magento/dev/tests/functional/etc/config.xml"
125+
rm -f "${magento_stash_dir}/magento/dev/tests/integration/phpunit.xml"
126+
rm -f "${magento_stash_dir}/magento/dev/tests/integration/etc/install-config-mysql.php"
127+
rm -f "${magento_stash_dir}/magento/dev/tests/unit/phpunit.xml"
128128
fi
129129
}
130130

131131
function unstashMagentoCodebase()
132132
{
133-
magento_stash_dir="${magento_codebase_stash_dir}/${current_codebase}/magento2ce"
133+
magento_stash_dir="${magento_codebase_stash_dir}/${current_codebase}/magento"
134134
if [[ ${skip_codebase_stash} == 0 ]] && [[ -d "${magento_stash_dir}" ]]; then
135135
echo "${grey}## unstashMagentoCodebase${regular}"
136136
echo "## unstashMagentoCodebase" >>${current_log_file_path}
137-
mv "${magento_stash_dir}" "${vagrant_dir}/magento2ce"
137+
mv "${magento_stash_dir}" "${vagrant_dir}/magento"
138138
fi
139139
}
140140

tests/testsuite.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ function testNoCustomConfig()
5353
installEnvironment
5454
# assertVarnishDisabled
5555
executeCommonAssertions
56-
# assertMagentoEditionIsCE
57-
# assertCeSampleDataNotInstalled
58-
# assertTestsConfigured
59-
# assertDebugConfigurationWork
60-
# assertRedisCacheIsEnabled
56+
assertMagentoEditionIsCE
57+
assertCeSampleDataNotInstalled
58+
assertTestsConfigured
59+
assertDebugConfigurationWork
60+
assertRedisCacheIsEnabled
6161
}
6262

6363
## Call and Run all Tests

0 commit comments

Comments
 (0)