Skip to content

Commit

Permalink
Fixed issue causing static test failure to report success/green on Tr…
Browse files Browse the repository at this point in the history
…avis

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.
  • Loading branch information
davidalger committed Jun 7, 2017
1 parent 2bc3bb0 commit 849717c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 38 deletions.
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ env:
- MAGENTO_HOST_NAME="magento2.travis"
matrix:
- TEST_SUITE=unit
- TEST_SUITE=static
- TEST_SUITE=js GRUNT_COMMAND=spec
- TEST_SUITE=js GRUNT_COMMAND=static
- TEST_SUITE=integration INTEGRATION_INDEX=1
- TEST_SUITE=integration INTEGRATION_INDEX=2
- TEST_SUITE=integration INTEGRATION_INDEX=3
- TEST_SUITE=static
- TEST_SUITE=js
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
matrix:
exclude:
- php: 7.0
env: TEST_SUITE=static
- php: 7.0
env: TEST_SUITE=js
env: TEST_SUITE=js GRUNT_COMMAND=spec
- php: 7.0
env: TEST_SUITE=js GRUNT_COMMAND=static
- php: 7.0
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
- php: 7.0
Expand All @@ -49,4 +52,11 @@ cache:
before_install: ./dev/travis/before_install.sh
install: composer install --no-interaction --prefer-dist
before_script: ./dev/travis/before_script.sh
script: ./dev/travis/script.sh
script:
# Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true

# The scripts for grunt/phpunit type tests
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi
2 changes: 1 addition & 1 deletion dev/travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ phpenv rehash;
test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true

# Node.js setup via NVM
if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then
if [ test $TEST_SUITE == "js" ]; then
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
Expand Down
28 changes: 17 additions & 11 deletions dev/travis/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,26 @@ case $TEST_SUITE in
cat "$changed_files_ce" | sed 's/^/ + including /'

cd ../../..

cp package.json.sample package.json
cp Gruntfile.js.sample Gruntfile.js
yarn
;;
js)
cp package.json.sample package.json
cp Gruntfile.js.sample Gruntfile.js
yarn

echo "Installing Magento"
mysql -uroot -e 'CREATE DATABASE magento2;'
php bin/magento setup:install -q --admin-user="admin" --admin-password="123123q" --admin-email="admin@example.com" --admin-firstname="John" --admin-lastname="Doe"

echo "Deploying Static Content"
php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
if [[ $GRUNT_COMMAND != "static" ]]; then
echo "Installing Magento"
mysql -uroot -e 'CREATE DATABASE magento2;'
php bin/magento setup:install -q \
--admin-user="admin" \
--admin-password="123123q" \
--admin-email="admin@example.com" \
--admin-firstname="John" \
--admin-lastname="Doe"

echo "Deploying Static Content"
php bin/magento setup:static-content:deploy -f -q -j=2 \
--no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
fi
;;
functional)
echo "Installing Magento"
Expand All @@ -117,7 +121,9 @@ case $TEST_SUITE in

composer install && composer require se/selenium-server-standalone:2.53.1
export DISPLAY=:1.0
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 &
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 &

cp ./phpunit.xml.dist ./phpunit.xml
sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
sed -e "s?basic?travis_acceptance_${ACCEPTANCE_INDEX}?g" --in-place ./phpunit.xml
Expand Down
22 changes: 0 additions & 22 deletions dev/travis/script.sh

This file was deleted.

0 comments on commit 849717c

Please sign in to comment.