Skip to content

Commit

Permalink
Fix race condition in e2e test script
Browse files Browse the repository at this point in the history
The build detection relied on looking up the build ID immediately
after a webhook simulation, and then repeatedly querying that build
for status. If the ID lookup beats the build record creation, the
script will time out looking for a nil build.

Look at the build list for status instead to eliminate the race.
  • Loading branch information
ironcladlou committed Nov 1, 2014
1 parent c43d88f commit e9a2441
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions hack/test-end-to-end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ curl -s -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Git

# Wait for build to complete
echo "[INFO] Waiting for build to complete"
BUILD_ID=`$openshift kube list builds --template="{{with index .Items 0}}{{.ID}}{{end}}"`
wait_for_command "$openshift kube get builds/$BUILD_ID | grep complete" $((40*TIME_MIN)) "$openshift kube get builds/$BUILD_ID | grep failed"
wait_for_command "$openshift kube list builds | grep -i complete" $((30*TIME_MIN)) "$openshift kube list builds | grep -i failed"

echo "[INFO] Waiting for database pod to start"
wait_for_command "$openshift kube list pods | grep database | grep Running" $((30*TIME_SEC))
Expand Down

0 comments on commit e9a2441

Please sign in to comment.