Skip to content
Snippets Groups Projects
Commit 4014c18d authored by Maddy Chellathurai's avatar Maddy Chellathurai
Browse files

MAGETWO-38216: Reduce Execution Time of Integration Tests on Travis CI

-CR comments
parent 2376c672
Branches
Tags
No related merge requests found
...@@ -33,7 +33,7 @@ before_script: ...@@ -33,7 +33,7 @@ before_script:
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
# Install MySQL 5.6, create DB for integration tests # Install MySQL 5.6, create DB for integration tests
- > - >
sh -c "if [ '$TEST_SUITE' = 'integration_integrity' ]; then sh -c "if [ '$TEST_SUITE' = 'integrationPart1' ] || [ '$TEST_SUITE' = 'integrationPart2' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then
sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5; sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5;
sudo apt-get autoremove; sudo apt-get autoremove;
sudo apt-get autoclean; sudo apt-get autoclean;
......
#usr/bin/bash #!usr/bin/bash
#get number of files in directory # Get number of files in directory
NUMBER_OF_SUITES=$1 NUMBER_OF_SUITES=$1
FOLDERSIZE=$(find ./testsuite/Magento/ -maxdepth 1 -type d|wc -l) FOLDERSIZE=$(find ./testsuite/Magento/ -maxdepth 1 -type d|wc -l)
FOLDERSIZE=$((FOLDERSIZE/NUMBER_OF_SUITES)) FOLDERSIZE=$((FOLDERSIZE/NUMBER_OF_SUITES))
#get folders # Get folders
FOLDERS=$(ls "./testsuite/Magento") FOLDERS=$(ls "./testsuite/Magento")
#mysql 5.6 # Create n testsuites
sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5;
sudo apt-get autoremove;
sudo apt-get autoclean;
sudo apt-add-repository ppa:ondrej/mysql-5.6 -y;
sudo apt-get update;
sudo apt-get install mysql-server-5.6 mysql-client-5.6;
#create n testsuites and n databases
i=0 i=0
for i in `seq 1 $NUMBER_OF_SUITES` for i in `seq 1 $NUMBER_OF_SUITES`
do do
cp phpunit.xml.dist phpunit.xml.travis$i cp phpunit.xml.dist phpunit.xml.travis$i
perl -pi -e "s/<directory suffix=\"Test.php\">testsuite<\/directory>//g" phpunit.xml.travis$i
cp etc/install-config-mysql.php.dist etc/install-config-mysql$i.php
mysql -uroot -e "SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; create database magento_integration_tests${i}";
done done
#replace Memory Usage Tests in all except testsuite 1 # Replace Memory Usage Tests in all except testsuite 1
for i in `seq 2 $NUMBER_OF_SUITES` for i in `seq 2 $NUMBER_OF_SUITES`
do do
perl -pi -e 's/<!-- Memory tests run first to prevent influence of other tests on accuracy of memory measurements -->//g' phpunit.xml.travis$i perl -i -0pe 's/(<!-- Memory)(.*?)(<\/testsuite>)//ims' phpunit.xml.travis$i
perl -pi -e 's/<testsuite name="Memory Usage Tests">//g' phpunit.xml.travis$i
perl -pi -e 's/<file>testsuite\/Magento\/MemoryUsageTest.php<\/file>//g' phpunit.xml.travis$i
perl -pi -e 's/<\/testsuite>//g' phpunit.xml.travis$i
perl -pi -e "s/<\/testsuites>/<\/testsuite><\/testsuites>/g" phpunit.xml.travis$i
done done
#create list of folders on which tests are to be run # Create list of folders on which tests are to be run
i=0 i=0
j=1 j=1
for FOLDER in $FOLDERS for FOLDER in $FOLDERS
...@@ -49,10 +34,8 @@ do ...@@ -49,10 +34,8 @@ do
fi fi
done done
# finally replacing in config files. # Finally replacing in config files.
for i in `seq 1 $NUMBER_OF_SUITES` for i in `seq 1 $NUMBER_OF_SUITES`
do do
perl -pi -e "s/<directory suffix=\"Test.php\">..\/..\/..\/update\/dev\/tests\/integration\/testsuite<\/directory>/${FILE[i]}/g" phpunit.xml.travis$i perl -pi -e "s/<directory suffix=\"Test.php\">testsuite<\/directory>/${FILE[i]}/g" phpunit.xml.travis$i
perl -pi -e "s/magento_integration_tests/magento_integration_tests${i}/g" etc/install-config-mysql${i}.php
perl -pi -e "s/etc\/install-config-mysql.php/etc\/install-config-mysql${i}.php/g" phpunit.xml.travis$i
done done
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment