tests/robustness: Fix pointer causing all cluster tests using kubernetes traffic

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
Marek Siarkowicz 2023-05-10 16:08:04 +02:00
parent 2bb9930ffa
commit 165a76b506

View File

@ -41,7 +41,7 @@ func TestRobustness(t *testing.T) {
scenarios = append(scenarios, testScenario{ scenarios = append(scenarios, testScenario{
name: "ClusterOfSize1/" + traffic.Name, name: "ClusterOfSize1/" + traffic.Name,
failpoint: RandomFailpoint, failpoint: RandomFailpoint,
traffic: &traffic, traffic: traffic,
cluster: *e2e.NewConfig( cluster: *e2e.NewConfig(
e2e.WithClusterSize(1), e2e.WithClusterSize(1),
e2e.WithSnapshotCount(100), e2e.WithSnapshotCount(100),
@ -64,7 +64,7 @@ func TestRobustness(t *testing.T) {
scenarios = append(scenarios, testScenario{ scenarios = append(scenarios, testScenario{
name: "ClusterOfSize3/" + traffic.Name, name: "ClusterOfSize3/" + traffic.Name,
failpoint: RandomFailpoint, failpoint: RandomFailpoint,
traffic: &traffic, traffic: traffic,
cluster: *e2e.NewConfig(clusterOfSize3Options...), cluster: *e2e.NewConfig(clusterOfSize3Options...),
}) })
} }
@ -87,7 +87,7 @@ func TestRobustness(t *testing.T) {
scenarios = append(scenarios, testScenario{ scenarios = append(scenarios, testScenario{
name: "Issue13766", name: "Issue13766",
failpoint: KillFailpoint, failpoint: KillFailpoint,
traffic: &traffic.HighTraffic, traffic: traffic.HighTraffic,
cluster: *e2e.NewConfig( cluster: *e2e.NewConfig(
e2e.WithSnapshotCount(100), e2e.WithSnapshotCount(100),
), ),
@ -106,7 +106,7 @@ func TestRobustness(t *testing.T) {
scenarios = append(scenarios, testScenario{ scenarios = append(scenarios, testScenario{
name: "Issue15271", name: "Issue15271",
failpoint: BlackholeUntilSnapshot, failpoint: BlackholeUntilSnapshot,
traffic: &traffic.HighTraffic, traffic: traffic.HighTraffic,
cluster: *e2e.NewConfig( cluster: *e2e.NewConfig(
e2e.WithSnapshotCount(100), e2e.WithSnapshotCount(100),
e2e.WithPeerProxy(true), e2e.WithPeerProxy(true),
@ -115,8 +115,8 @@ func TestRobustness(t *testing.T) {
}) })
} }
for _, scenario := range scenarios { for _, scenario := range scenarios {
if scenario.traffic == nil { if scenario.traffic == (traffic.Config{}) {
scenario.traffic = &traffic.LowTraffic scenario.traffic = traffic.LowTraffic
} }
t.Run(scenario.name, func(t *testing.T) { t.Run(scenario.name, func(t *testing.T) {
@ -132,7 +132,7 @@ type testScenario struct {
name string name string
failpoint Failpoint failpoint Failpoint
cluster e2e.EtcdProcessClusterConfig cluster e2e.EtcdProcessClusterConfig
traffic *traffic.Config traffic traffic.Config
watch watchConfig watch watchConfig
} }
@ -180,7 +180,7 @@ func (s testScenario) run(ctx context.Context, t *testing.T, lg *zap.Logger, clu
maxRevisionChan := make(chan int64, 1) maxRevisionChan := make(chan int64, 1)
g.Go(func() error { g.Go(func() error {
defer close(maxRevisionChan) defer close(maxRevisionChan)
operations = traffic.SimulateTraffic(ctx, t, lg, clus, *s.traffic, finishTraffic) operations = traffic.SimulateTraffic(ctx, t, lg, clus, s.traffic, finishTraffic)
maxRevisionChan <- operationsMaxRevision(operations) maxRevisionChan <- operationsMaxRevision(operations)
return nil return nil
}) })