From 085d64f75e4bc8148b5c2d34b1d85b40eec5d277 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Thu, 23 Jan 2025 08:41:35 -0800 Subject: [PATCH] Flaky test --- .aspect/workflows/bazelrc | 3 +++ BUILD.bazel | 9 +++++++++ flake.sh | 11 +++++++++++ 3 files changed, 23 insertions(+) create mode 100755 flake.sh diff --git a/.aspect/workflows/bazelrc b/.aspect/workflows/bazelrc index 33fb1ce4..a9ea9ff5 100644 --- a/.aspect/workflows/bazelrc +++ b/.aspect/workflows/bazelrc @@ -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=5 \ No newline at end of file diff --git a/BUILD.bazel b/BUILD.bazel index e8bc8110..8c77cddc 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -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", + ], +) diff --git a/flake.sh b/flake.sh new file mode 100755 index 00000000..122971eb --- /dev/null +++ b/flake.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -o errexit + +COUNT=$((RANDOM%3)) +echo $COUNT + +if [[ "${COUNT}" == "1" ]]; then + exit 0 +else + exit 1 +fi