Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7e8285

Browse files
authored
chore: retry failing tests in CI (#17681)
This PR introduces failing test retries in CI for e2e tests, Go testswith the in-memory database, Go tests with Postgres, and the CLI tests.Retries are not enabled for race tests.The goal is to reduce how often flakes disrupt developers' workflows.
1 parentd9b00e4 commita7e8285

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ jobs:
382382
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
383383
fi
384384
export TS_DEBUG_DISCO=true
385-
gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" \
386-
--packages="./..." -- $PARALLEL_FLAG -short -failfast
385+
gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json"--rerun-fails=2\
386+
--packages="./..." -- $PARALLEL_FLAG -short
387387
388388
-name:Upload Test Cache
389389
uses:./.github/actions/test-cache/upload
@@ -436,6 +436,7 @@ jobs:
436436
TS_DEBUG_DISCO:"true"
437437
LC_CTYPE:"en_US.UTF-8"
438438
LC_ALL:"en_US.UTF-8"
439+
TEST_RETRIES:2
439440
shell:bash
440441
run:|
441442
# By default Go will use the number of logical CPUs, which
@@ -499,6 +500,7 @@ jobs:
499500
TS_DEBUG_DISCO:"true"
500501
LC_CTYPE:"en_US.UTF-8"
501502
LC_ALL:"en_US.UTF-8"
503+
TEST_RETRIES:2
502504
shell:bash
503505
run:|
504506
# By default Go will use the number of logical CPUs, which
@@ -560,6 +562,7 @@ jobs:
560562
env:
561563
POSTGRES_VERSION:"16"
562564
TS_DEBUG_DISCO:"true"
565+
TEST_RETRIES:2
563566
run:|
564567
make test-postgres
565568
@@ -784,6 +787,7 @@ jobs:
784787
if:${{ !matrix.variant.premium }}
785788
env:
786789
DEBUG:pw:api
790+
CODER_E2E_TEST_RETRIES:2
787791
working-directory:site
788792

789793
# Run all of the tests with a premium license
@@ -793,6 +797,7 @@ jobs:
793797
DEBUG:pw:api
794798
CODER_E2E_LICENSE:${{ secrets.CODER_E2E_LICENSE }}
795799
CODER_E2E_REQUIRE_PREMIUM_TESTS:"1"
800+
CODER_E2E_TEST_RETRIES:2
796801
working-directory:site
797802

798803
-name:Upload Playwright Failed Tests

‎Makefile‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -875,12 +875,19 @@ provisioner/terraform/testdata/version:
875875
fi
876876
.PHONY: provisioner/terraform/testdata/version
877877

878+
# Set the retry flags if TEST_RETRIES is set
879+
ifdefTEST_RETRIES
880+
GOTESTSUM_RETRY_FLAGS := --rerun-fails=$(TEST_RETRIES)
881+
else
882+
GOTESTSUM_RETRY_FLAGS :=
883+
endif
884+
878885
test:
879-
$(GIT_FLAGS) gotestsum --format standard-quiet-- -v -short -count=1 ./...$(if$(RUN),-run$(RUN))
886+
$(GIT_FLAGS) gotestsum --format standard-quiet$(GOTESTSUM_RETRY_FLAGS) --packages="./..." -- -v -short -count=1$(if$(RUN),-run$(RUN))
880887
.PHONY: test
881888

882889
test-cli:
883-
$(GIT_FLAGS) gotestsum --format standard-quiet-- -v -short -count=1 ./cli/...
890+
$(GIT_FLAGS) gotestsum --format standard-quiet$(GOTESTSUM_RETRY_FLAGS) --packages="./cli/..." -- -v -short -count=1
884891
.PHONY: test-cli
885892

886893
# sqlc-cloud-is-setup will fail if no SQLc auth token is set. Use this as a
@@ -919,9 +926,9 @@ test-postgres: test-postgres-docker
919926
$(GIT_FLAGS) DB=ci gotestsum\
920927
--junitfile="gotests.xml"\
921928
--jsonfile="gotests.json"\
929+
$(GOTESTSUM_RETRY_FLAGS)\
922930
--packages="./..." --\
923931
-timeout=20m\
924-
-failfast\
925932
-count=1
926933
.PHONY: test-postgres
927934

‎site/e2e/playwright.config.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,30 @@ import {
1010
}from"./constants";
1111

1212
exportconstwsEndpoint=process.env.CODER_E2E_WS_ENDPOINT;
13+
exportconstretries=(()=>{
14+
if(process.env.CODER_E2E_TEST_RETRIES===undefined){
15+
returnundefined;
16+
}
17+
constcount=Number.parseInt(process.env.CODER_E2E_TEST_RETRIES,10);
18+
if(Number.isNaN(count)){
19+
thrownewError(
20+
`CODER_E2E_TEST_RETRIES is not a number:${process.env.CODER_E2E_TEST_RETRIES}`,
21+
);
22+
}
23+
if(count<0){
24+
thrownewError(
25+
`CODER_E2E_TEST_RETRIES is less than 0:${process.env.CODER_E2E_TEST_RETRIES}`,
26+
);
27+
}
28+
returncount;
29+
})();
1330

1431
constlocalURL=(port:number,path:string):string=>{
1532
return`http://localhost:${port}${path}`;
1633
};
1734

1835
exportdefaultdefineConfig({
36+
retries,
1937
globalSetup:require.resolve("./setup/preflight"),
2038
projects:[
2139
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp