Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
108741: pkg/cmd/dev: show case how to pass envvars to tests r=chrisseto a=chrisseto

Previously, it was difficult to track down the recommended way to pass environment variables, such as `COCKROACH_RANDOM_SEED`, to tests. A developer would have had to notice that `dev` passes arguments after `--` directly to bazel and that bazel supports a `--test_env` flag for `bazel test`. Additionally, grepping the codebase environment test specific environment variables would yield no relevant results.

This commit adds an intentionally repetitive example to `dev test` showcasing how to override `COCKROACH_RANDOM_SEED`. This example and presence of `COCKROACH_RANDOM_SEED` will hopefully enhance the discoverability of `dev`'s bazel pass through capabilities and the `--test_env` bazel flag.

Epic: none
Release note: None

Co-authored-by: Chris Seto <[email protected]>
  • Loading branch information
craig[bot] and chrisseto committed Aug 15, 2023
2 parents f765e3b + fcb5ace commit 58e9d7d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cmd/dev/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ pkg/kv/kvserver:kvserver_test) instead.`,
Run a test repeatedly until at least N seconds have passed (useful if "dev test --stress" ends too quickly and you want to keep the test running for a while)
dev test pkg/server -f=TestSpanStatsResponse -v --count=5 --vmodule='raft=1'
Run a specific test, multiple times, with increased logging verbosity
dev test pkg/server -- --test_env=COCKROACH_RANDOM_SEED=1234
Run a test with a specified seed by passing the --test_env flag directly to bazel
`,
Args: cobra.MinimumNArgs(0),
RunE: runE,
Expand Down

0 comments on commit 58e9d7d

Please sign in to comment.