|
6 | 6 | # with one or more Puppet versions, with PUPPET_VERSIONS set to a space-separated list |
7 | 7 | # of versions to test. |
8 | 8 |
|
9 | | -[ -z "$PUPPET_VERSIONS" ] && export PUPPET_VERSIONS='3.8.7 4.10.8 5.0.0' |
| 9 | +if [ -z "$PUPPET_VERSIONS" ]; then |
| 10 | + echo "Required PUPPET_VERSIONS!" |
| 11 | + exit 255 |
| 12 | +fi |
| 13 | + |
10 | 14 | [ -z "$RUBOCOP_TEST" ] && export RUBOCOP_TEST='true' |
11 | 15 | [ -z "$RSPEC_TEST" ] && export RSPEC_TEST='true' |
12 | 16 |
|
|
19 | 23 | echo "travis_fold:end:cibuild-environment-dump" |
20 | 24 |
|
21 | 25 | # Create a temporary file to capture output of various steps. |
22 | | -export OUTPUT_FILE="$(mktemp)" |
23 | 26 | function cleanup() { |
24 | | - rm -rf "$OUTPUT_FILE" |
25 | 27 | rm -f "${DIR}/.ruby-version" |
26 | 28 | } |
27 | 29 | trap cleanup EXIT |
@@ -95,12 +97,39 @@ if [ "$RSPEC_TEST" = "true" ]; then |
95 | 97 | fi |
96 | 98 |
|
97 | 99 | # Run the tests |
98 | | - echo "Running tests" |
99 | | - time bundle exec rake test |
| 100 | + echo "Running rspec unit tests" |
| 101 | + export COVERAGE=true |
| 102 | + time bundle exec rspec "${DIR}/spec/octocatalog-diff/tests" |
100 | 103 | exitcode=$? |
| 104 | + unset COVERAGE |
101 | 105 | if [ "$exitcode" -ne 0 ]; then RSPEC_EXITCODE="$exitcode"; fi |
102 | | - cat "$OUTPUT_FILE" |
| 106 | + |
| 107 | + # Quick coverage report |
| 108 | + "$DIR/script/display-coverage-report" "$DIR/coverage/coverage.json" |
103 | 109 | echo "" |
| 110 | + |
| 111 | + # To avoid travis getting hung if it gets confused, we'll run each of these |
| 112 | + # scripts individually with a timeout. This will hopefully address the problem |
| 113 | + # of hung builds. |
| 114 | + echo "Running rspec integration tests" |
| 115 | + for file in "${DIR}"/spec/octocatalog-diff/integration/*_spec.rb; do |
| 116 | + retry=1 |
| 117 | + for try in 1 2 3 ; do |
| 118 | + if [ $retry -eq 1 ]; then |
| 119 | + retry=0 |
| 120 | + echo "$(basename "$file") try ${try}" |
| 121 | + "$DIR/script/timeout" 180 bundle exec rspec "$file" |
| 122 | + exitcode=$? |
| 123 | + if [ $exitcode -eq 124 ] && [ $try -eq 3 ]; then |
| 124 | + RSPEC_EXITCODE="255" |
| 125 | + elif [ $exitcode -eq 124 ] && [ $try -lt 3 ]; then |
| 126 | + retry=1 |
| 127 | + elif [ $exitcode -ne 0 ]; then |
| 128 | + RSPEC_EXITCODE="$exitcode" |
| 129 | + fi |
| 130 | + fi |
| 131 | + done |
| 132 | + done |
104 | 133 | done |
105 | 134 | export PATH="$SAVED_PATH" |
106 | 135 | unset PUPPET_VERSION |
|
0 commit comments