Skip to content

Commit ddf247d

Browse files
author
Alex Paliarush
committed
Adjusted tests to accommodate changes made in "Improve UX of CLI scripts #73"
1 parent a1d27e2 commit ddf247d

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

_files/ce_prefer_source_varnish_enabled_config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ magento:
2121
currency: "USD"
2222
admin_user: "admin"
2323
admin_password: "123123q"
24+
debug:
25+
# Enable detailed output from all scripts provided by current vagrant project
26+
# [Changes applied immediately]
27+
vagrant_project: 1

include/assertions.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ function assertMagentoReinstallWorks()
111111
cd "${vagrant_dir}"
112112
bash m-reinstall >>${current_log_file_path} 2>&1
113113
pattern="Access storefront at .*(http\://magento2\.vagrant[0-9/:\.]+).*"
114-
output_log="$(tail -n5 ${current_log_file_path})"
114+
if [[ ${debug_vagrant_project} -eq 1 ]]; then
115+
tail_number=300
116+
else
117+
tail_number=5
118+
fi
119+
output_log="$(tail -n${tail_number} ${current_log_file_path})"
115120
assertTrue 'Magento reinstallation failed (Frontend URL is not available in the output)' '[[ ${output_log} =~ ${pattern} ]]'
116121
}
117122

@@ -144,7 +149,12 @@ function assertMagentoCliWorks()
144149
cd "${vagrant_dir}"
145150
bash m-bin-magento list >>${current_log_file_path} 2>&1
146151
pattern="theme:uninstall"
147-
output_log="$(tail -n2 ${current_log_file_path})"
152+
if [[ ${debug_vagrant_project} -eq 1 ]]; then
153+
tail_number=55
154+
else
155+
tail_number=2
156+
fi
157+
output_log="$(tail -n${tail_number} ${current_log_file_path})"
148158
assertTrue "${red}Magento CLI does not work.${regular}" '[[ ${output_log} =~ ${pattern} ]]'
149159
}
150160

@@ -227,7 +237,7 @@ function assertNoErrorsInLogs()
227237
assertTrue "Errors found in log file:
228238
${grep_cannot}" '[[ ${count_cannot} -eq 0 ]]'
229239

230-
grep_error="$(cat "${current_log_file_path}" | grep -i "error" | grep -iv "errors = Off|display" | grep -iv "error_reporting = E_ALL" | grep -iv "assertNoErrorsInLogs" | grep -iv "shared folder errors")"
240+
grep_error="$(cat "${current_log_file_path}" | grep -i "error" | grep -iv "errors = Off|display" | grep -iv "error_reporting = E_ALL" | grep -iv "assertNoErrorsInLogs" | grep -iv "shared folder errors" | grep -iv "\+\+ logError" | grep -iv "\+\+ outputErrorsOnly" | grep -iv "\+\+ errors=" | grep -iv "\+\+ which bash")"
231241
count_error="$(echo ${grep_error} | grep -ic "error")"
232242
assertTrue "Errors found in log file:
233243
${grep_error}" '[[ ${count_error} -eq 0 ]]'

testsuite.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ function oneTimeSetUp
1414
clearLogs
1515
}
1616

17+
function setUp()
18+
{
19+
debug_vagrant_project=0
20+
}
21+
1722
function tearDown()
1823
{
1924
assertNoErrorsInLogs
@@ -91,6 +96,7 @@ function testCePreferSourceVarnishEnabled()
9196
{
9297
current_config_name="ce_prefer_source_varnish_enabled"
9398
current_codebase="ce"
99+
debug_vagrant_project=1
94100
installEnvironment
95101
assertVarnishEnabled
96102
executeCommonAssertions

0 commit comments

Comments
 (0)