Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. URL=$1 # Jenkins input step return URL
  4. USER=$2 # Jenkins username
  5. PASS=$3 # Jenkins API token
  6.  
  7. echo "=================================================================="
  8. echo "Starting Testing..."
  9. echo "=================================================================="
  10.  
  11. # The test suite repo is copied here in its entirety
  12. cd /tmp/src
  13.  
  14. # Change "skiptests" to false in pom.xml
  15. sed -i 's/<skipTests>true/<skipTests>false/g' pom.xml
  16.  
  17. # Run all tests in test suite and continue even if tests fail
  18. mvn clean install --projects Hello --projects World || true
  19.  
  20. TESTCOUNT=$(ls */target/cucumber.json | wc -l)
  21. echo "There were $TESTCOUNT tests run."
  22.  
  23. # Make directory for all Cucumber json files
  24. mkdir reports
  25.  
  26. # For cucumber.json files, take it and move it to reports directory
  27. # Change name of file to [count].json so they don't overwrite each other
  28. for ((i = 1 ; i <= $TESTCOUNT ; i++)); do
  29. CUR=$(ls */target/cucumber.json | tail -n +$i | head -1)
  30. echo $CUR
  31. cp -f $CUR reports/$i.json
  32. done
  33.  
  34. # Notify Jenkins pipeline that tests have finished
  35. curl -X POST --user $USER:$PASS \
  36. $URL
  37.  
  38. # Give a little time to make sure oc rsync works
  39. # Pod will scale down after this finishes
  40. sleep 1m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement