@@ -383,7 +383,12 @@ jobs:
383
383
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
384
384
fi
385
385
export TS_DEBUG_DISCO=true
386
- gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" --rerun-fails=2 \
386
+ TEST_RETRIES="--rerun-fails=2"
387
+ if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
388
+ # on main, run tests without retries
389
+ TEST_RETRIES=""
390
+ fi
391
+ gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" $TEST_RETRIES \
387
392
--packages="./..." -- $PARALLEL_FLAG -short
388
393
389
394
-name :Upload Test Cache
@@ -547,16 +552,20 @@ jobs:
547
552
TESTCOUNT="-count=1"
548
553
fi
549
554
555
+ TEST_RETRIES="--rerun-fails=2 --rerun-fails-max-failures=50"
556
+ if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
557
+ # on main, run tests without retries
558
+ TEST_RETRIES=""
559
+ fi
560
+
550
561
mkdir -p "$RUNNER_TEMP/sym"
551
562
source scripts/normalize_path.sh
552
563
# terraform gets installed in a random directory, so we need to normalize
553
564
# the path to the terraform binary or a bunch of cached tests will be
554
565
# invalidated. See scripts/normalize_path.sh for more details.
555
566
normalize_path_with_symlinks "$RUNNER_TEMP/sym" "$(dirname $(which terraform))"
556
567
557
- # We rerun failing tests to counteract flakiness coming from Postgres
558
- # choking on macOS and Windows sometimes.
559
- DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=50 \
568
+ DB=ci gotestsum $TEST_RETRIES \
560
569
--format standard-quiet --packages "./..." \
561
570
-- -timeout=20m -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
562
571
@@ -619,7 +628,8 @@ jobs:
619
628
env :
620
629
POSTGRES_VERSION :" 17"
621
630
TS_DEBUG_DISCO :" true"
622
- TEST_RETRIES :2
631
+ # on main, run tests without retries
632
+ TEST_RETRIES :" {{ github.ref == 'refs/heads/hugodutka/disable-test-retries-on-main' && '' || '--rerun-fails=2 --rerun-fails-max-failures=50' }}"
623
633
run :|
624
634
make test-postgres
625
635
@@ -670,7 +680,12 @@ jobs:
670
680
# c.f. discussion on https://github.com/coder/coder/pull/15106
671
681
-name :Run Tests
672
682
run :|
673
- gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
683
+ TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
684
+ if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
685
+ # on main, run tests without retries
686
+ TEST_RETRIES=""
687
+ fi
688
+ gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
674
689
675
690
-name :Upload Test Cache
676
691
uses :./.github/actions/test-cache/upload
@@ -721,8 +736,13 @@ jobs:
721
736
env :
722
737
POSTGRES_VERSION :" 17"
723
738
run :|
739
+ TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
740
+ if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
741
+ # on main, run tests without retries
742
+ TEST_RETRIES=""
743
+ fi
724
744
make test-postgres-docker
725
- DB=ci gotestsum --junitfile="gotests.xml" --packages="./..."--rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
745
+ DB=ci gotestsum --junitfile="gotests.xml" --packages="./..."$TEST_RETRIES -- -race -parallel 4 -p 4
726
746
727
747
-name :Upload Test Cache
728
748
uses :./.github/actions/test-cache/upload