Skip to content

Commit

Permalink
Fix a flaky test that failed by race condition
Browse files Browse the repository at this point in the history
after alpine-edge latest update, test_it_aborts_on_unknown_push_errors
failed in alpine but ok in ubuntu. It seems the deleting repo function
that used by the test executed faster than before in alpine, which then
cause the "put" failed fast when first pulling the repo.

Making it to sleep 2 second to ensure the "put" finishes the pull first
fix the test.

Signed-off-by: Rui Yang <[email protected]>
  • Loading branch information
Rui Yang committed Apr 21, 2020
1 parent 990bb4a commit 2dbde7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/test_out.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ test_it_tries_to_rebase_repeatedly_in_race_conditions() {
assertEquals "$baseref1" "$grandparent_of_tip"
}

delete_repository_after_1_second() {
delete_repository_after_2_second() {
local repo=$1
sleep 1
sleep 2
rm -r $repo
}

Expand All @@ -296,7 +296,7 @@ test_it_aborts_on_unknown_push_errors() {

local response=$(mktemp $TMPDIR/rebased-response.XXXXXX)

delete_repository_after_1_second $repo1 &
delete_repository_after_2_second $repo1 &

local rebased_repo=$(mktemp -d "$TMPDIR/hg-repo-at-$ref.XXXXXX")
TEST_REPO_AT_REF_DIR="$rebased_repo"
Expand Down

0 comments on commit 2dbde7b

Please sign in to comment.