Skip to content

Commit 849717c

Browse files
committed
Fixed issue causing static test failure to report success/green on Travis
Regression was introduced in e68d69c; can't use a script that does not exit on command failure or exit code is always zero for anything but the last command the script ran. Additionally, moved the test script back into .travis.yml because test failure inside a .sh script will not include sufficient error output.
1 parent 2bc3bb0 commit 849717c

File tree

4 files changed

+32
-38
lines changed

4 files changed

+32
-38
lines changed

.travis.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@ env:
2222
- MAGENTO_HOST_NAME="magento2.travis"
2323
matrix:
2424
- TEST_SUITE=unit
25+
- TEST_SUITE=static
26+
- TEST_SUITE=js GRUNT_COMMAND=spec
27+
- TEST_SUITE=js GRUNT_COMMAND=static
2528
- TEST_SUITE=integration INTEGRATION_INDEX=1
2629
- TEST_SUITE=integration INTEGRATION_INDEX=2
2730
- TEST_SUITE=integration INTEGRATION_INDEX=3
28-
- TEST_SUITE=static
29-
- TEST_SUITE=js
3031
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
3132
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
3233
matrix:
3334
exclude:
3435
- php: 7.0
3536
env: TEST_SUITE=static
3637
- php: 7.0
37-
env: TEST_SUITE=js
38+
env: TEST_SUITE=js GRUNT_COMMAND=spec
39+
- php: 7.0
40+
env: TEST_SUITE=js GRUNT_COMMAND=static
3841
- php: 7.0
3942
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
4043
- php: 7.0
@@ -49,4 +52,11 @@ cache:
4952
before_install: ./dev/travis/before_install.sh
5053
install: composer install --no-interaction --prefer-dist
5154
before_script: ./dev/travis/before_script.sh
52-
script: ./dev/travis/script.sh
55+
script:
56+
# Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails
57+
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
58+
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
59+
60+
# The scripts for grunt/phpunit type tests
61+
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
62+
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi

dev/travis/before_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ phpenv rehash;
2121
test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true
2222

2323
# Node.js setup via NVM
24-
if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then
24+
if [ test $TEST_SUITE == "js" ]; then
2525
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
2626
export NVM_DIR="$HOME/.nvm"
2727
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

dev/travis/before_script.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,26 @@ case $TEST_SUITE in
7575
cat "$changed_files_ce" | sed 's/^/ + including /'
7676

7777
cd ../../..
78-
79-
cp package.json.sample package.json
80-
cp Gruntfile.js.sample Gruntfile.js
81-
yarn
8278
;;
8379
js)
8480
cp package.json.sample package.json
8581
cp Gruntfile.js.sample Gruntfile.js
8682
yarn
8783

88-
echo "Installing Magento"
89-
mysql -uroot -e 'CREATE DATABASE magento2;'
90-
php bin/magento setup:install -q --admin-user="admin" --admin-password="123123q" --admin-email="[email protected]" --admin-firstname="John" --admin-lastname="Doe"
91-
92-
echo "Deploying Static Content"
93-
php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
84+
if [[ $GRUNT_COMMAND != "static" ]]; then
85+
echo "Installing Magento"
86+
mysql -uroot -e 'CREATE DATABASE magento2;'
87+
php bin/magento setup:install -q \
88+
--admin-user="admin" \
89+
--admin-password="123123q" \
90+
--admin-email="[email protected]" \
91+
--admin-firstname="John" \
92+
--admin-lastname="Doe"
93+
94+
echo "Deploying Static Content"
95+
php bin/magento setup:static-content:deploy -f -q -j=2 \
96+
--no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
97+
fi
9498
;;
9599
functional)
96100
echo "Installing Magento"
@@ -117,7 +121,9 @@ case $TEST_SUITE in
117121

118122
composer install && composer require se/selenium-server-standalone:2.53.1
119123
export DISPLAY=:1.0
120-
sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 -Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log &
124+
sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 \
125+
-Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log &
126+
121127
cp ./phpunit.xml.dist ./phpunit.xml
122128
sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
123129
sed -e "s?basic?travis_acceptance_${ACCEPTANCE_INDEX}?g" --in-place ./phpunit.xml

dev/travis/script.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)