Skip to content

Commit 2d73067

Browse files
committed
roachtest: move roachtest
1 parent e9fac83 commit 2d73067

File tree

4 files changed

+53
-39
lines changed

4 files changed

+53
-39
lines changed

pkg/cmd/roachtest/tests/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ go_library(
9090
"import_cancellation.go",
9191
"inconsistency.go",
9292
"indexes.go",
93+
"invariant_check_detection.go",
9394
"inverted_index.go",
9495
"jasyncsql.go",
9596
"jasyncsql_blocklist.go",

pkg/cmd/roachtest/tests/acceptance.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ import (
1111
"time"
1212

1313
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
14-
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
1514
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
1615
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/spec"
1716
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
18-
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
1917
"github.com/cockroachdb/errors"
20-
"github.com/stretchr/testify/require"
2118
)
2219

2320
func registerAcceptance(r registry.Registry) {
@@ -84,22 +81,6 @@ func registerAcceptance(r registry.Registry) {
8481
// and version upgrade is impossible to test as of 05/2025.
8582
incompatibleClouds: registry.OnlyIBM,
8683
},
87-
// Tests for maybeSaveClusterDueToInvariantProblems. These don't verify
88-
// that everything works as it should, but they can be run to verify
89-
// manually that the cluster is saved correctly and the log output is
90-
// helpful.
91-
{
92-
name: "invariant-check-detection/failed=true",
93-
fn: runInvariantCheckDetectionFailed,
94-
timeout: time.Hour,
95-
skip: "manual only",
96-
},
97-
{
98-
name: "invariant-check-detection/failed=false",
99-
fn: runInvariantCheckDetectionSuccess,
100-
timeout: time.Hour,
101-
skip: "manual only",
102-
},
10384
},
10485
registry.OwnerDisasterRecovery: {
10586
{
@@ -192,23 +173,3 @@ func registerAcceptance(r registry.Registry) {
192173
}
193174
}
194175
}
195-
196-
func runInvariantCheckDetectionFailed(ctx context.Context, t test.Test, c cluster.Cluster) {
197-
runInvariantCheckDetection(ctx, t, c, true)
198-
}
199-
200-
func runInvariantCheckDetectionSuccess(ctx context.Context, t test.Test, c cluster.Cluster) {
201-
runInvariantCheckDetection(ctx, t, c, false)
202-
}
203-
204-
func runInvariantCheckDetection(ctx context.Context, t test.Test, c cluster.Cluster, failed bool) {
205-
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), c.Range(1, 3))
206-
require.NoError(t, c.PutString(ctx, `
207-
foo br baz
208-
F250502 11:37:20.387424 1036 raft/raft.go:2411 ⋮ [T1,Vsystem,n1,s1,r155/1:‹/Table/113/1/{43/578…-51/201…}›] 80 match(30115) is out of range [lastIndex(30114)]. Was the raft log corrupted, truncated, or lost?
209-
asdasds
210-
`, "logs/foo.log", 0644, c.Node(2)))
211-
if failed {
212-
t.Error("boom")
213-
}
214-
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2025 The Cockroach Authors.
2+
//
3+
// Use of this software is governed by the CockroachDB Software License
4+
// included in the /LICENSE file.
5+
6+
package tests
7+
8+
import (
9+
"context"
10+
"fmt"
11+
12+
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
13+
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
14+
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
15+
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/spec"
16+
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
17+
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
18+
"github.com/stretchr/testify/require"
19+
)
20+
21+
func registerInvariantCheckDetection(r registry.Registry) {
22+
// Tests for maybeSaveClusterDueToInvariantProblems. These don't verify
23+
// that everything works as it should, but they can be run to verify
24+
// manually that the cluster is saved correctly and the log output is
25+
// helpful.
26+
27+
for _, failed := range []bool{false, true} {
28+
r.Add(registry.TestSpec{
29+
CompatibleClouds: registry.AllClouds,
30+
Name: fmt.Sprintf("invariant-check-detection/failed=%t", failed),
31+
Owner: registry.OwnerTestEng,
32+
Suites: registry.ManualOnly,
33+
Cluster: spec.ClusterSpec{NodeCount: 1, CPUs: 4, ReusePolicy: spec.ReusePolicyNone{}},
34+
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
35+
runInvariantCheckDetection(ctx, t, c, failed)
36+
},
37+
})
38+
}
39+
}
40+
41+
func runInvariantCheckDetection(ctx context.Context, t test.Test, c cluster.Cluster, failed bool) {
42+
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), c.Node(1))
43+
require.NoError(t, c.PutString(ctx, `
44+
foo br baz
45+
F250502 11:37:20.387424 1036 raft/raft.go:2411 ⋮ [T1,Vsystem,n1,s1,r155/1:‹/Table/113/1/{43/578…-51/201…}›] 80 match(30115) is out of range [lastIndex(30114)]. Was the raft log corrupted, truncated, or lost?
46+
asdasds
47+
`, "logs/foo.log", 0644, c.Node(1)))
48+
if failed {
49+
t.Error("boom")
50+
}
51+
}

pkg/cmd/roachtest/tests/registry.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func RegisterTests(r registry.Registry) {
7777
registerImportTPCH(r)
7878
registerInconsistency(r)
7979
registerIndexes(r)
80+
registerInvariantCheckDetection(r)
8081
registerJasyncSQL(r)
8182
registerJepsen(r)
8283
registerJobs(r)

0 commit comments

Comments
 (0)