Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. config.vm.provision "shell", inline: <<-SHELL
  2. 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
  3. debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password defaultPassword' #confirm password
  4. echo "Password set for MySQL"
  5. sudo apt-get install -y mysql-server # install mysql-server yes to all inputs
  6. echo "MySQL server installed"
  7. sudo apt-get install git -y #install git to clone repositorys yes to all inputs
  8. echo "Git installed"
  9. git clone https://gitlab.cs.cf.ac.uk/CM6212/northwind.git #clone the northwind database and data creation scipt
  10. echo "northwind database downloaded"
  11. cd northwind #change to the northwind directory we just cloned
  12. sudo mysql --user=root --password=defaultPassword < northwind.sql #run the northwind db creation script
  13. echo "northwind database created"
  14. sudo mysql --user=root --password=defaultPassword < northwind-data.sql #run the northwind data script to input data into the database
  15. echo "northwind database populated"
  16. cd ..
  17. git clone https://github.com/chippindale/devops.git #clone the devops repo which contains the test.sql script and testpass criteria
  18. echo "Tests downloaded"
  19. cd devops
  20. 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
  21. 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.
  22. then
  23. echo "Test passed" >> TestResults.txt
  24. else
  25. echo "Test failed" >> TestResult.txt
  26. fi
  27. echo "Setup Complete"
  28. SHELL
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement