Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: make dev test --count 1 invalidate cached test results #109476

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fi
set -euo pipefail

# Bump this counter to force rebuilding `dev` on all machines.
DEV_VERSION=84
DEV_VERSION=85

THIS_DIR=$(cd "$(dirname "$0")" && pwd)
BINARY_DIR=$THIS_DIR/bin/dev-versions
Expand Down
15 changes: 9 additions & 6 deletions pkg/cmd/dev/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pkg/kv/kvserver:kvserver_test) instead.`,
// visible.
testCmd.Flags().BoolP(vFlag, "v", false, "show testing process output")
testCmd.Flags().Bool(changedFlag, false, "automatically determine tests to run. This is done on a best-effort basis by asking git which files have changed. Only .go files and files in testdata/ directories are factored into this analysis.")
testCmd.Flags().Int(countFlag, 1, "run test the given number of times")
testCmd.Flags().Int(countFlag, 0, "run test the given number of times")
testCmd.Flags().BoolP(showLogsFlag, "", false, "show crdb logs in-line")
testCmd.Flags().Bool(stressFlag, false, "run tests under stress")
testCmd.Flags().Bool(raceFlag, false, "run tests using race builds")
Expand Down Expand Up @@ -281,9 +281,6 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error {
}

args = append(args, testTargets...)
if ignoreCache {
args = append(args, "--nocache_test_results")
}
args = append(args, "--test_env=GOTRACEBACK=all")

if rewrite {
Expand Down Expand Up @@ -336,7 +333,7 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error {
}

if stress {
if count == 1 {
if count == 0 {
// Default to 1000 unless a different count was provided.
count = 1000
}
Expand All @@ -362,7 +359,9 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error {
if showLogs {
args = append(args, "--test_arg", "-show-logs")
}
if count != 1 {
if count == 1 {
ignoreCache = true
} else if count != 0 {
args = append(args, fmt.Sprintf("--runs_per_test=%d", count))
}
if vModule != "" {
Expand All @@ -379,6 +378,10 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error {
args = append(args, "--test_sharding_strategy=disabled")
}

if ignoreCache {
args = append(args, "--nocache_test_results")
}

if len(goTags) > 0 {
args = append(args, "--define", "gotags=bazel,gss,"+strings.Join(goTags, ","))
}
Expand Down
17 changes: 11 additions & 6 deletions pkg/cmd/dev/testdata/datadriven/test
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bazel test pkg/util/tracing:all --test_env=GOTRACEBACK=all '--test_filter=TestSt
exec
dev test pkg/util/tracing -f TestStartChild* --ignore-cache
----
bazel test pkg/util/tracing:all --nocache_test_results --test_env=GOTRACEBACK=all '--test_filter=TestStartChild*' --test_sharding_strategy=disabled --test_output errors --build_event_binary_file=/tmp/path
bazel test pkg/util/tracing:all --test_env=GOTRACEBACK=all '--test_filter=TestStartChild*' --test_sharding_strategy=disabled --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path

exec
dev test //pkg/testutils --timeout=10s
Expand Down Expand Up @@ -62,7 +62,7 @@ exec
dev test pkg/cmd/dev -f TestDataDriven/test --rewrite -v
----
bazel info workspace --color=no
bazel test pkg/cmd/dev:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/cmd/dev --test_filter=TestDataDriven/test --test_arg -test.v --test_sharding_strategy=disabled --test_output all --build_event_binary_file=/tmp/path
bazel test pkg/cmd/dev:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/cmd/dev --test_filter=TestDataDriven/test --test_arg -test.v --test_sharding_strategy=disabled --nocache_test_results --test_output all --build_event_binary_file=/tmp/path

exec
dev test pkg/server -f=TestSpanStatsResponse -v --count=5 --vmodule=raft=1
Expand All @@ -84,7 +84,7 @@ exec
dev test pkg/ccl/logictestccl -f=TestTenantLogic/3node-tenant/system -v --rewrite
----
bazel info workspace --color=no
bazel test pkg/ccl/logictestccl:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/ccl/logictestccl --sandbox_writable_path=crdb-checkout/pkg/sql/logictest --sandbox_writable_path=crdb-checkout/pkg/sql/opt/exec/execbuilder --test_filter=TestTenantLogic/3node-tenant/system --test_arg -test.v --test_sharding_strategy=disabled --test_output all --build_event_binary_file=/tmp/path
bazel test pkg/ccl/logictestccl:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/ccl/logictestccl --sandbox_writable_path=crdb-checkout/pkg/sql/logictest --sandbox_writable_path=crdb-checkout/pkg/sql/opt/exec/execbuilder --test_filter=TestTenantLogic/3node-tenant/system --test_arg -test.v --test_sharding_strategy=disabled --nocache_test_results --test_output all --build_event_binary_file=/tmp/path

exec
dev test pkg/spanconfig/spanconfigkvsubscriber -f=TestDecodeSpanTargets -v --stream-output
Expand Down Expand Up @@ -115,19 +115,19 @@ exec
dev test pkg/sql/schemachanger --rewrite -v
----
bazel info workspace --color=no
bazel test pkg/sql/schemachanger:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/schemachanger --test_arg -test.v --test_sharding_strategy=disabled --test_output all --build_event_binary_file=/tmp/path
bazel test pkg/sql/schemachanger:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/schemachanger --test_arg -test.v --test_sharding_strategy=disabled --nocache_test_results --test_output all --build_event_binary_file=/tmp/path

exec
dev test pkg/sql/opt/xform --rewrite
----
bazel info workspace --color=no
bazel test pkg/sql/opt/xform:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/opt/xform --sandbox_writable_path=crdb-checkout/pkg/sql/opt/testutils/opttester/testfixtures --test_sharding_strategy=disabled --test_output errors --build_event_binary_file=/tmp/path
bazel test pkg/sql/opt/xform:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/opt/xform --sandbox_writable_path=crdb-checkout/pkg/sql/opt/testutils/opttester/testfixtures --test_sharding_strategy=disabled --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path

exec
dev test pkg/sql/... --rewrite
----
bazel info workspace --color=no
bazel test pkg/sql/... --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql --test_sharding_strategy=disabled --test_output errors --build_event_binary_file=/tmp/path
bazel test pkg/sql/... --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql --test_sharding_strategy=disabled --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path

exec
dev test pkg/spanconfig/spanconfigstore --test-args '-test.timeout=0.5s'
Expand Down Expand Up @@ -162,3 +162,8 @@ dev test pkg/spanconfig/spanconfigstore --stress --count 250
----
getenv DEV_I_UNDERSTAND_ABOUT_STRESS
bazel test pkg/spanconfig/spanconfigstore:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_STRESS=true --notest_keep_going --runs_per_test=250 --test_output errors --build_event_binary_file=/tmp/path

exec
dev test pkg/spanconfig/spanconfigstore --count 1
----
bazel test pkg/spanconfig/spanconfigstore:all --test_env=GOTRACEBACK=all --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path