Skip to content

Commit ec83247

Browse files
craig[bot]wenyihu6
andcommitted
Merge #150167
150167: nightlies: run `TestDataDriven` once under `cockroach_nightly_extra_stress_impl.sh` r=tbg,stevendanna a=wenyihu6 **nightlies: run `TestDataDriven` once under `cockroach_nightly_extra_stress_impl.sh`** `TestDataDriven` in `pkg/kv/kvserver/asim/tests/datadriven_simulation_test.go` is slow and doesn't add much value on CI, as it's datadriven and mainly checks for determinism. To reduce CI load, this commit adds a `skip_under_ci` flag to skip specific test files that take a long time to run during standard CI. To retain test coverage, we’ll continue running them once with a longer timeout in the Nightly Cockroach Extra Stress pipeline we recently introduced. Epic: none Release note: none --- **asim: add `skip_under_ci` for some tests in `pkg/kv/kvserver/asim/tests`** This commit adds the skip_under_ci flag to the `example_rebalancing`, `example_fulldisk`, `example_liveness`, `example_splitting`, and `example_zone_config` test files, as they tend to run for a longer duration. We plan to extend this flag to additional long-running tests in the future. Epic: none Release note: none Co-authored-by: wenyihu6 <[email protected]>
2 parents 2473184 + ba4715a commit ec83247

File tree

8 files changed

+43
-0
lines changed

8 files changed

+43
-0
lines changed

build/teamcity/cockroach/nightlies/cockroach_nightly_extra_stress_impl.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ bazel build //pkg/cmd/bazci
5555
BAZEL_BIN=$(bazel info bazel-bin)
5656

5757
exit_status=0
58+
59+
# Run TestDataDriven from the asim package once with COCKROACH_RUN_ASIM_TESTS enabled.
60+
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci -- test //pkg/kv/kvserver/asim/tests:tests_test \
61+
--config=$BAZEL_CONFIG \
62+
--test_env TC_SERVER_URL \
63+
--test_env COCKROACH_RUN_ASIM_TESTS=true \
64+
--test_filter="^TestDataDriven$" \
65+
--test_timeout=3600 \
66+
|| exit_status=$?
67+
68+
# Run the rest of the tests under stress.
5869
$BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci -- test $TEST_PACKAGE_TARGETS \
5970
--config=$BAZEL_CONFIG \
6071
--test_env TC_SERVER_URL \

pkg/kv/kvserver/asim/tests/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ go_test(
5050
"//pkg/spanconfig/spanconfigtestutils",
5151
"//pkg/testutils/datapathutils",
5252
"//pkg/testutils/skip",
53+
"//pkg/util/envutil",
54+
"//pkg/util/leaktest",
55+
"//pkg/util/log",
5356
"@com_github_cockroachdb_datadriven//:datadriven",
5457
"@com_github_guptarohit_asciigraph//:asciigraph",
5558
"@com_github_stretchr_testify//require",

pkg/kv/kvserver/asim/tests/datadriven_simulation_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ import (
2525
"github.com/cockroachdb/cockroach/pkg/spanconfig/spanconfigtestutils"
2626
"github.com/cockroachdb/cockroach/pkg/testutils/datapathutils"
2727
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
28+
"github.com/cockroachdb/cockroach/pkg/util/envutil"
29+
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
30+
"github.com/cockroachdb/cockroach/pkg/util/log"
2831
"github.com/cockroachdb/datadriven"
2932
"github.com/guptarohit/asciigraph"
3033
"github.com/stretchr/testify/require"
3134
)
3235

36+
var runAsimTests = envutil.EnvOrDefaultBool("COCKROACH_RUN_ASIM_TESTS", false)
37+
3338
// TestDataDriven is a data-driven test for the allocation system using the
3439
// simulator. It gives contributors a way to understand how a cluster reacts to
3540
// different settings, load and configuration. In addition, it may be used for
@@ -168,6 +173,8 @@ import (
168173
// ..US_3
169174
// ....└── [11 12 13 14 15]
170175
func TestDataDriven(t *testing.T) {
176+
defer leaktest.AfterTest(t)()
177+
defer log.Scope(t).Close(t)
171178
skip.UnderDuressWithIssue(t, 149875)
172179
ctx := context.Background()
173180
dir := datapathutils.TestDataPath(t, "non_rand")
@@ -186,6 +193,12 @@ func TestDataDriven(t *testing.T) {
186193
require.Empty(t, d.CmdArgs, "leftover arguments for %s", d.Cmd)
187194
}()
188195
switch d.Cmd {
196+
case "skip_under_ci":
197+
if !runAsimTests {
198+
t.Logf("skipping %s: skip_under_ci and COCKROACH_RUN_ASIM_TESTS is not set", path)
199+
t.SkipNow()
200+
}
201+
return ""
189202
case "gen_load":
190203
var rwRatio, rate = 0.0, 0.0
191204
var minBlock, maxBlock = 1, 1
@@ -372,6 +385,7 @@ func TestDataDriven(t *testing.T) {
372385

373386
return ""
374387
case "eval":
388+
t.Logf("running eval for %s", path)
375389
samples := 1
376390
seed := rand.Int63()
377391
duration := 30 * time.Minute

pkg/kv/kvserver/asim/tests/testdata/non_rand/example_fulldisk.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
skip_under_ci
2+
----
3+
14
# Set every store's capacity to 512 GiB, we will later adjust just one store to
25
# have less free capacity.
36
gen_cluster nodes=5 store_byte_capacity=549755813888

pkg/kv/kvserver/asim/tests/testdata/non_rand/example_liveness.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
skip_under_ci
2+
----
3+
14
# This example sets n7 to dead initially and n5 to decommissioning after 2
25
# minutes. The output of replicas per store is then plotted.
36
#

pkg/kv/kvserver/asim/tests/testdata/non_rand/example_rebalancing.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
skip_under_ci
2+
----
3+
14
# Walk through the basics of the datadriven syntax. Create a state generator
25
# where there are 7 stores, 7 ranges and initially the replicas are placed
36
# following a skewed distribution (where s1 has the most replicas, s2 has half

pkg/kv/kvserver/asim/tests/testdata/non_rand/example_splitting.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
skip_under_ci
2+
----
3+
14
# Explore how load based and sized based splitting occur in isolation. In this
25
# example, there is only one store so no rebalancing activity should occur.
36
gen_cluster nodes=1

pkg/kv/kvserver/asim/tests/testdata/non_rand/example_zone_config.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
skip_under_ci
2+
----
3+
14
# This test applies a configuration that prioritizes zone constraints, favoring
25
# the US_East region. As a result, we expect a majority of replicas to be
36
# distributed across stores numbered 1-12, all within the US_East region. The

0 commit comments

Comments
 (0)