Skip to content

Commit

Permalink
Flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Jan 23, 2025
1 parent 9bce23d commit ee869f4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .aspect/workflows/bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ common:rbe --remote_executor=unix:///mnt/ephemeral/buildbarn/.cache/bb_clientd/g
common:rbe --genrule_strategy=remote,local
common:rbe --jobs=32
common:rbe --remote_timeout=3600

# retry flaky tests
common --flaky_test_attempts=2
9 changes: 9 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ js_library(
":node_modules/typescript-eslint",
],
)

sh_test(
name = "flaky_sh_test",
srcs = ["flake.sh"],
flaky = True,
tags = [
"expected_to_fail",
],
)
20 changes: 20 additions & 0 deletions flake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -o errexit

MARKER="/tmp/flake"

if [[ ! -f "$MARKER" ]]; then
echo "1"
echo "1" >"${MARKER}"
fi

COUNT=$(cat $MARKER)

if [[ "${COUNT}" == "1" ]]; then
echo "2"
echo "2" >"${MARKER}"
exit 1
else
rm "${MARKER}"
exit 0
fi

0 comments on commit ee869f4

Please sign in to comment.