From fe776162ac3aaac1a9ee863e7d2269c58d313573 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Sat, 5 Oct 2024 13:32:09 +0200 Subject: [PATCH] Fix issue with cluster logs being misattributed by identify failpoint availability on temporary cluster Signed-off-by: Marek Siarkowicz --- tests/robustness/main_test.go | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/robustness/main_test.go b/tests/robustness/main_test.go index 63ba6b377638..6e2700a7bf5d 100644 --- a/tests/robustness/main_test.go +++ b/tests/robustness/main_test.go @@ -44,26 +44,39 @@ func TestMain(m *testing.M) { func TestRobustnessExploratory(t *testing.T) { testRunner.BeforeTest(t) for _, s := range exploratoryScenarios(t) { - t.Run(s.name, func(t *testing.T) { + ctx := context.Background() + s.failpoint = randomFailpointForConfig(ctx, t, s.profile, s.cluster) + t.Run(s.name+"/"+s.failpoint.Name(), func(t *testing.T) { lg := zaptest.NewLogger(t) s.cluster.Logger = lg - ctx := context.Background() c, err := e2e.NewEtcdProcessCluster(ctx, t, e2e.WithConfig(&s.cluster)) if err != nil { t.Fatal(err) } defer forcestopCluster(c) - s.failpoint, err = failpoint.PickRandom(c, s.profile) - if err != nil { - t.Fatal(err) - } - t.Run(s.failpoint.Name(), func(t *testing.T) { - testRobustness(ctx, t, lg, s, c) - }) + testRobustness(ctx, t, lg, s, c) }) } } +// TODO: Implement lightweight a way to generate list of failpoints without needing to start a cluster +func randomFailpointForConfig(ctx context.Context, t *testing.T, profile traffic.Profile, config e2e.EtcdProcessClusterConfig) failpoint.Failpoint { + config.Logger = zap.NewNop() + c, err := e2e.NewEtcdProcessCluster(ctx, t, e2e.WithConfig(&config)) + if err != nil { + t.Fatal(err) + } + f, err := failpoint.PickRandom(c, profile) + if err != nil { + t.Fatal(err) + } + err = forcestopCluster(c) + if err != nil { + t.Fatal(err) + } + return f +} + func TestRobustnessRegression(t *testing.T) { testRunner.BeforeTest(t) for _, s := range regressionScenarios(t) {