Skip to content

Commit

Permalink
c2c: add acceptance test
Browse files Browse the repository at this point in the history
This patch adds a lightweight acceptance test that calls the main c2c roachtest
driver. This will add a c2c roachtest to Essential CI, preventing future
patches from inadvertently breaking the C2C roachtest driver.

Fixes cockroachdb#99230

Release note: None
  • Loading branch information
msbutler committed Mar 24, 2023
1 parent 5641526 commit 1aaa9d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
8 changes: 8 additions & 0 deletions pkg/cmd/roachtest/tests/acceptance.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ func registerAcceptance(r registry.Registry) {
timeout: 30 * time.Minute,
},
},
registry.OwnerDisasterRecovery: {
{
name: "c2c",
fn: runAcceptanceClusterReplication,
numNodes: 3,
timeout: 5 * time.Minute,
},
},
}
tags := []string{"default", "quick"}
specTemplate := registry.TestSpec{
Expand Down
23 changes: 21 additions & 2 deletions pkg/cmd/roachtest/tests/cluster_to_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,23 @@ func (sp *replicationTestSpec) main(ctx context.Context, t test.Test, c cluster.
)
lv.assertValid(t)
}
func runAcceptanceClusterReplication(ctx context.Context, t test.Test, c cluster.Cluster) {
if !c.IsLocal() {
t.Fatal("acceptance tests should only run on a local cluster")
}
sp := replicationTestSpec{
srcNodes: 1,
dstNodes: 1,
// The timeout field ensures the c2c roachtest driver behaves properly.
timeout: 5 * time.Minute,
workload: replicateKV{readPercent: 0, debugRunDurationMinutes: 1},
additionalDuration: 0 * time.Minute,
cutover: 30 * time.Second,
}
sp.setupC2C(ctx, t, c)
sp.main(ctx, t, c)
}

func registerClusterToCluster(r registry.Registry) {
for _, sp := range []replicationTestSpec{
{
Expand Down Expand Up @@ -664,7 +681,7 @@ func registerClusterToCluster(r registry.Registry) {
cpus: 4,
pdSize: 10,
workload: replicateKV{readPercent: 0, debugRunDurationMinutes: 1},
timeout: 20 * time.Minute,
timeout: 5 * time.Minute,
additionalDuration: 0 * time.Minute,
cutover: 30 * time.Second,
skip: "for local ad hoc testing",
Expand All @@ -683,7 +700,9 @@ func registerClusterToCluster(r registry.Registry) {
} {
sp := sp
clusterOps := make([]spec.Option, 0)
clusterOps = append(clusterOps, spec.CPU(sp.cpus))
if sp.cpus != 0 {
clusterOps = append(clusterOps, spec.CPU(sp.cpus))
}
if sp.pdSize != 0 {
clusterOps = append(clusterOps, spec.VolumeSize(sp.pdSize))
}
Expand Down

0 comments on commit 1aaa9d7

Please sign in to comment.