-
Notifications
You must be signed in to change notification settings - Fork 65
Use bazel CI to repeat tests and identify flakes #939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6624e08
4da1dd2
a5ad8d2
1fdf01d
7d72098
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: Bazel repeat flaky tests | ||
| on: | ||
| schedule: | ||
| # GitHub caches are purged after 7 days of inactivity, so | ||
| # running twice a week helps protect the bazel cache | ||
| # Run at 14:00 UTC, Monday and Friday | ||
| - cron: '0 14 * * 1,5' | ||
|
|
||
| jobs: | ||
| repeat-flaky-tests: | ||
| uses: ./.github/workflows/bazel_repeat_tests.yml | ||
| with: | ||
| flaky: 1 | ||
| runs_per_test: 10 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: Bazel repeat non-flaky tests | ||
| on: | ||
| schedule: | ||
| # GitHub caches are purged after 7 days of inactivity, so | ||
| # running twice a week helps protect the bazel cache | ||
| # Run at 15:00 UTC, Monday and Friday | ||
| - cron: '0 15 * * 1,5' | ||
|
|
||
| jobs: | ||
| repeat-non-flaky-tests: | ||
| uses: ./.github/workflows/bazel_repeat_tests.yml | ||
| with: | ||
| flaky: 0 | ||
| runs_per_test: 10 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||||||||||||||||||
| name: Bazel repeat tests | ||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||
| workflow_call: | ||||||||||||||||||||||||||||
| inputs: &shared_inputs | ||||||||||||||||||||||||||||
| flaky: | ||||||||||||||||||||||||||||
| description: "0 to execute non-flaky tests, 1 to execute flaky tests" | ||||||||||||||||||||||||||||
| default: 0 | ||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||
| runs_per_test: | ||||||||||||||||||||||||||||
| description: "Number of times to repeat each test" | ||||||||||||||||||||||||||||
| default: 10 | ||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||
| inputs: *shared_inputs | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||
| repeat-tests: | ||||||||||||||||||||||||||||
| uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v7.7.0 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| folders: | | ||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||
| "." | ||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||
| exclude: | | ||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||
| {"folder": ".", "bzlmodEnabled": false} | ||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||
| exclude_windows: true | ||||||||||||||||||||||||||||
| bazel_test_command: | | ||||||||||||||||||||||||||||
| # Exit with success code 0 if no targets match the query | ||||||||||||||||||||||||||||
| # `grep -q '^' fails if the query output is empty | ||||||||||||||||||||||||||||
| bazel query "attr(flaky, ${{ inputs.flaky }}, tests(//...))" \ | ||||||||||||||||||||||||||||
| | grep -q '^' || exit 0 | ||||||||||||||||||||||||||||
| bazel test --runs_per_test=${{ inputs.runs_per_test }} \ | ||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||
| --test_output=errors \ | ||||||||||||||||||||||||||||
| $(bazel query "attr(flaky, ${{ inputs.flaky }}, tests(//...))") | ||||||||||||||||||||||||||||
|
Comment on lines
+32
to
+38
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This step runs with
Suggested change
|
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,13 +143,27 @@ test_sources = glob( | |
| include = ["src/*_TEST.cc"], | ||
| ) | ||
|
|
||
| # Found with | ||
| # bazel test test:all --runs_per_test 10 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this comment was copied from |
||
| flaky_test_srcs = [ | ||
| "src/Clock_TEST.cc", | ||
| "src/Node_TEST.cc", | ||
| ] | ||
|
|
||
| # Tests that should not be executed in parallel | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe expand on why this test should run exclusively? |
||
| exclusive_test_srcs = [ | ||
| "src/Clock_TEST.cc", | ||
| ] | ||
|
|
||
| [cc_test( | ||
| name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), | ||
| srcs = [src], | ||
| env = { | ||
| "GZ_BAZEL": "1", | ||
| "GZ_IP": "127.0.0.1", | ||
| }, | ||
| flaky = src in flaky_test_srcs, | ||
| tags = ["exclusive"] if src in exclusive_test_srcs else [], | ||
| deps = [ | ||
| ":gz-transport", | ||
| ":gz-transport-discovery-header", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the defaults are numbers but the type is
string. Should we usetype: number?