From ab7f797a1b6ff7cede163dcf4b006b7089970492 Mon Sep 17 00:00:00 2001 From: reshke Date: Tue, 2 Apr 2024 19:08:20 +0000 Subject: [PATCH] Drop all distributions after scenario --- test/feature/spqr_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/feature/spqr_test.go b/test/feature/spqr_test.go index e7027e838..58ec750c6 100644 --- a/test/feature/spqr_test.go +++ b/test/feature/spqr_test.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/pg-sharding/spqr/pkg/models/spqrerror" "io" "log" "os" @@ -17,6 +16,8 @@ import ( "text/template" "time" + "github.com/pg-sharding/spqr/pkg/models/spqrerror" + "github.com/cucumber/godog" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/stdlib" @@ -804,10 +805,20 @@ func InitializeScenario(s *godog.ScenarioContext, t *testing.T) { log.Println(err) log.Println("sleeping") time.Sleep(time.Hour) + return ctx, err } if tctx.templateErr != nil { log.Fatalf("Error in templating %s: %v\n", step.Text, tctx.templateErr) } + ds, err := tctx.qdb.ListDistributions(ctx) + if err != nil { + return ctx, err + } + for _, d := range ds { + if err := tctx.qdb.DropDistribution(ctx, d.ID); err != nil { + return ctx, err + } + } return ctx, nil }) s.After(func(ctx context.Context, scenario *godog.Scenario, err error) (context.Context, error) {