Rerun failed spinach tests

This commit is contained in:
Kamil Trzcinski 2016-06-07 13:06:24 +02:00
parent 498f8d13d0
commit 03a7569ea6
2 changed files with 99 additions and 71 deletions

View file

@ -48,7 +48,7 @@ stages:
- knapsack/ - knapsack/
knapsack: knapsack:
<<: *knapsack_state <<: *rspec-knapsack_state
stage: prepare stage: prepare
script: script:
- mkdir -p knapsack/ - mkdir -p knapsack/
@ -56,7 +56,7 @@ knapsack:
- '[[ -f knapsack/spinach_report.json ]] || echo "{}" > knapsack/spinach_report.json' - '[[ -f knapsack/spinach_report.json ]] || echo "{}" > knapsack/spinach_report.json'
update-knapsack: update-knapsack:
<<: *knapsack_state <<: *rspec-knapsack_state
stage: post-test stage: post-test
script: script:
- scripts/merge-reports knapsack/rspec_report.json knapsack/rspec_node_*.json - scripts/merge-reports knapsack/rspec_report.json knapsack/rspec_node_*.json
@ -65,57 +65,73 @@ update-knapsack:
# Execute all testing suites # Execute all testing suites
.knapsack: &knapsack .rspec-knapsack: &knapsack
stage: test stage: test
script: script:
- bundle exec rake assets:precompile 2>/dev/null - bundle exec rake assets:precompile 2>/dev/null
- JOB_NAME=( $CI_BUILD_NAME ) - JOB_NAME=( $CI_BUILD_NAME )
- export CI_NODE_INDEX=${JOB_NAME[1]} - export CI_NODE_INDEX=${JOB_NAME[1]}
- export CI_NODE_TOTAL=${JOB_NAME[2]} - export CI_NODE_TOTAL=${JOB_NAME[2]}
- export KNAPSACK_REPORT_PATH=knapsack/${JOB_NAME}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - export KNAPSACK_REPORT_PATH=knapsack/rspec_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export KNAPSACK_GENERATE_REPORT=true - export KNAPSACK_GENERATE_REPORT=true
- cp knapsack/${JOB_NAME}_report.json ${KNAPSACK_REPORT_PATH} - cp knapsack/rspec_report.json ${KNAPSACK_REPORT_PATH}
- knapsack ${JOB_NAME[0]} - knapsack rspec
artifacts: artifacts:
paths: paths:
- knapsack/ - knapsack/
rspec 0 20: *knapsack .spinach-knapsack: &knapsack
rspec 1 20: *knapsack stage: test
rspec 2 20: *knapsack script:
rspec 3 20: *knapsack - bundle exec rake assets:precompile 2>/dev/null
rspec 4 20: *knapsack - JOB_NAME=( $CI_BUILD_NAME )
rspec 5 20: *knapsack - export CI_NODE_INDEX=${JOB_NAME[1]}
rspec 6 20: *knapsack - export CI_NODE_TOTAL=${JOB_NAME[2]}
rspec 7 20: *knapsack - export KNAPSACK_REPORT_PATH=knapsack/spinach_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
rspec 8 20: *knapsack - export KNAPSACK_GENERATE_REPORT=true
rspec 9 20: *knapsack - cp knapsack/spinach_report.json ${KNAPSACK_REPORT_PATH}
rspec 10 20: *knapsack - knapsack spinach[-r rerun]
rspec 11 20: *knapsack # retry failed tests 3 times
rspec 12 20: *knapsack - retry '[ ! -e tmp/spinach-rerun.txt ] || bin/spinach -r rerun $(cat tmp/spinach-rerun.txt)'
rspec 13 20: *knapsack artifacts:
rspec 14 20: *knapsack paths:
rspec 15 20: *knapsack - knapsack/
rspec 16 20: *knapsack
rspec 17 20: *knapsack
rspec 18 20: *knapsack
rspec 19 20: *knapsack
spinach 0 10: *knapsack rspec 0 20: *rspec-knapsack
spinach 1 10: *knapsack rspec 1 20: *rspec-knapsack
spinach 2 10: *knapsack rspec 2 20: *rspec-knapsack
spinach 3 10: *knapsack rspec 3 20: *rspec-knapsack
spinach 4 10: *knapsack rspec 4 20: *rspec-knapsack
spinach 5 10: *knapsack rspec 5 20: *rspec-knapsack
spinach 6 10: *knapsack rspec 6 20: *rspec-knapsack
spinach 7 10: *knapsack rspec 7 20: *rspec-knapsack
spinach 8 10: *knapsack rspec 8 20: *rspec-knapsack
spinach 9 10: *knapsack rspec 9 20: *rspec-knapsack
rspec 10 20: *rspec-knapsack
rspec 11 20: *rspec-knapsack
rspec 12 20: *rspec-knapsack
rspec 13 20: *rspec-knapsack
rspec 14 20: *rspec-knapsack
rspec 15 20: *rspec-knapsack
rspec 16 20: *rspec-knapsack
rspec 17 20: *rspec-knapsack
rspec 18 20: *rspec-knapsack
rspec 19 20: *rspec-knapsack
spinach 0 10: *spinach-knapsack
spinach 1 10: *spinach-knapsack
spinach 2 10: *spinach-knapsack
spinach 3 10: *spinach-knapsack
spinach 4 10: *spinach-knapsack
spinach 5 10: *spinach-knapsack
spinach 6 10: *spinach-knapsack
spinach 7 10: *spinach-knapsack
spinach 8 10: *spinach-knapsack
spinach 9 10: *spinach-knapsack
# Execute all testing suites against Ruby 2.2 # Execute all testing suites against Ruby 2.2
.knapsack-ruby22: &knapsack-ruby22 .ruby-22: &ruby22
<<: *knapsack
image: "ruby:2.2" image: "ruby:2.2"
only: only:
- master - master
@ -124,37 +140,45 @@ spinach 9 10: *knapsack
paths: paths:
- vendor - vendor
rspec 0 20 ruby22: *knapsack-ruby22 .rspec-knapsack-ruby22: &rspec-knapsack-ruby22
rspec 1 20 ruby22: *knapsack-ruby22 <<: *rspec-knapsack
rspec 2 20 ruby22: *knapsack-ruby22 <<: *ruby-22
rspec 3 20 ruby22: *knapsack-ruby22
rspec 4 20 ruby22: *knapsack-ruby22
rspec 5 20 ruby22: *knapsack-ruby22
rspec 6 20 ruby22: *knapsack-ruby22
rspec 7 20 ruby22: *knapsack-ruby22
rspec 8 20 ruby22: *knapsack-ruby22
rspec 9 20 ruby22: *knapsack-ruby22
rspec 10 20 ruby22: *knapsack-ruby22
rspec 11 20 ruby22: *knapsack-ruby22
rspec 12 20 ruby22: *knapsack-ruby22
rspec 13 20 ruby22: *knapsack-ruby22
rspec 14 20 ruby22: *knapsack-ruby22
rspec 15 20 ruby22: *knapsack-ruby22
rspec 16 20 ruby22: *knapsack-ruby22
rspec 17 20 ruby22: *knapsack-ruby22
rspec 18 20 ruby22: *knapsack-ruby22
rspec 19 20 ruby22: *knapsack-ruby22
spinach 0 10 ruby22: *knapsack-ruby22 .spinach-knapsack-ruby22: &spinach-knapsack-ruby22
spinach 1 10 ruby22: *knapsack-ruby22 <<: *rspec-knapsack
spinach 2 10 ruby22: *knapsack-ruby22 <<: *ruby-22
spinach 3 10 ruby22: *knapsack-ruby22
spinach 4 10 ruby22: *knapsack-ruby22 rspec 0 20 ruby22: *rspec-knapsack-ruby22
spinach 5 10 ruby22: *knapsack-ruby22 rspec 1 20 ruby22: *rspec-knapsack-ruby22
spinach 6 10 ruby22: *knapsack-ruby22 rspec 2 20 ruby22: *rspec-knapsack-ruby22
spinach 7 10 ruby22: *knapsack-ruby22 rspec 3 20 ruby22: *rspec-knapsack-ruby22
spinach 8 10 ruby22: *knapsack-ruby22 rspec 4 20 ruby22: *rspec-knapsack-ruby22
spinach 9 10 ruby22: *knapsack-ruby22 rspec 5 20 ruby22: *rspec-knapsack-ruby22
rspec 6 20 ruby22: *rspec-knapsack-ruby22
rspec 7 20 ruby22: *rspec-knapsack-ruby22
rspec 8 20 ruby22: *rspec-knapsack-ruby22
rspec 9 20 ruby22: *rspec-knapsack-ruby22
rspec 10 20 ruby22: *rspec-knapsack-ruby22
rspec 11 20 ruby22: *rspec-knapsack-ruby22
rspec 12 20 ruby22: *rspec-knapsack-ruby22
rspec 13 20 ruby22: *rspec-knapsack-ruby22
rspec 14 20 ruby22: *rspec-knapsack-ruby22
rspec 15 20 ruby22: *rspec-knapsack-ruby22
rspec 16 20 ruby22: *rspec-knapsack-ruby22
rspec 17 20 ruby22: *rspec-knapsack-ruby22
rspec 18 20 ruby22: *rspec-knapsack-ruby22
rspec 19 20 ruby22: *rspec-knapsack-ruby22
spinach 0 10 ruby22: *spinach-knapsack-ruby22
spinach 1 10 ruby22: *spinach-knapsack-ruby22
spinach 2 10 ruby22: *spinach-knapsack-ruby22
spinach 3 10 ruby22: *spinach-knapsack-ruby22
spinach 4 10 ruby22: *spinach-knapsack-ruby22
spinach 5 10 ruby22: *spinach-knapsack-ruby22
spinach 6 10 ruby22: *spinach-knapsack-ruby22
spinach 7 10 ruby22: *spinach-knapsack-ruby22
spinach 8 10 ruby22: *spinach-knapsack-ruby22
spinach 9 10 ruby22: *spinach-knapsack-ruby22
# Other generic tests # Other generic tests

View file

@ -1,12 +1,16 @@
#!/bin/bash #!/bin/bash
retry() { retry() {
for i in $(seq 1 3); do
if eval "$@"; then if eval "$@"; then
return 0 return 0
fi fi
for i in 2 1; do
sleep 3s sleep 3s
echo "Retrying..." echo "Retrying $i..."
if eval "$@"; then
return 0
fi
done done
return 1 return 1
} }