Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config.vm.provision "shell", inline: <<-SHELL
- debconf-set-selections <<< 'mysql-server mysql-server/root_password password defaultPassword' # set mySQL password to defaultPassword so it isnt a required input during installation process
- debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password defaultPassword' #confirm password
- echo "Password set for MySQL"
- sudo apt-get install -y mysql-server # install mysql-server yes to all inputs
- echo "MySQL server installed"
- sudo apt-get install git -y #install git to clone repositorys yes to all inputs
- echo "Git installed"
- git clone https://gitlab.cs.cf.ac.uk/CM6212/northwind.git #clone the northwind database and data creation scipt
- echo "northwind database downloaded"
- cd northwind #change to the northwind directory we just cloned
- sudo mysql --user=root --password=defaultPassword < northwind.sql #run the northwind db creation script
- echo "northwind database created"
- sudo mysql --user=root --password=defaultPassword < northwind-data.sql #run the northwind data script to input data into the database
- echo "northwind database populated"
- cd ..
- git clone https://github.com/chippindale/devops.git #clone the devops repo which contains the test.sql script and testpass criteria
- echo "Tests downloaded"
- cd devops
- sudo mysql --user=root --password=defaultPassword < SQL_test.sql > testcase.txt #run the test script against the northwind database, and pipe the result into results.txt
- if diff testcase.txt passTest.txt > /dev/null #check to see if the passTest which contains the correct result set is different to the results.txt that we just created. If they are the same the test script has run correctly. If not there was a failure. Export the result to dev/null so we dont have to deal with it.
- then
- echo "Test passed" >> TestResults.txt
- else
- echo "Test failed" >> TestResult.txt
- fi
- echo "Setup Complete"
- SHELL
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement