From de39000d4b715999aecca74bc17d18e0c2d12599 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 3 Jul 2024 07:59:59 +0300 Subject: [PATCH] A couple changes in Online DDL CI (#16272) Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- .../endtoend/onlineddl/flow/onlineddl_flow_test.go | 4 ++-- .../vrepl_suite/onlineddl_vrepl_suite_test.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go b/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go index aed3efcde2f..eee244ea6ed 100644 --- a/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go +++ b/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go @@ -339,7 +339,7 @@ func TestSchemaChange(t *testing.T) { }) isComplete := false t.Run("optimistic wait for migration completion", func(t *testing.T) { - status := onlineddl.WaitForMigrationStatus(t, &vtParams, shards, uuid, migrationWaitTimeout, schema.OnlineDDLStatusRunning, schema.OnlineDDLStatusComplete) + status := onlineddl.WaitForMigrationStatus(t, &vtParams, shards, uuid, migrationWaitTimeout, schema.OnlineDDLStatusComplete) isComplete = (status == schema.OnlineDDLStatusComplete) fmt.Printf("# Migration status (for debug purposes): <%s>\n", status) }) @@ -348,7 +348,7 @@ func TestSchemaChange(t *testing.T) { onlineddl.CheckForceMigrationCutOver(t, &vtParams, shards, uuid, true) }) t.Run("another optimistic wait for migration completion", func(t *testing.T) { - status := onlineddl.WaitForMigrationStatus(t, &vtParams, shards, uuid, migrationWaitTimeout, schema.OnlineDDLStatusRunning, schema.OnlineDDLStatusComplete) + status := onlineddl.WaitForMigrationStatus(t, &vtParams, shards, uuid, migrationWaitTimeout, schema.OnlineDDLStatusComplete) isComplete = (status == schema.OnlineDDLStatusComplete) fmt.Printf("# Migration status (for debug purposes): <%s>\n", status) }) diff --git a/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go b/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go index 6122a71aa44..d31f92695f1 100644 --- a/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go +++ b/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go @@ -56,16 +56,21 @@ var ( beforeTableName = `onlineddl_test_before` afterTableName = `onlineddl_test_after` eventName = `onlineddl_test` + + testsFilter = "" ) const ( - testDataPath = "testdata" + testDataPath = "testdata" + testFilterEnvVar = "ONLINEDDL_SUITE_TEST_FILTER" ) func TestMain(m *testing.M) { defer cluster.PanicHandler(nil) flag.Parse() + testsFilter = os.Getenv(testFilterEnvVar) + exitcode, err := func() (int, error) { clusterInstance = cluster.NewCluster(cell, hostname) schemaChangeDirectory = path.Join("/tmp", fmt.Sprintf("schema_change_dir_%d", clusterInstance.GetAndReserveTabletUID())) @@ -183,6 +188,10 @@ func readTestFile(t *testing.T, testName string, fileName string) (content strin // testSingle is the main testing function for a single test in the suite. // It prepares the grounds, creates the test data, runs a migration, expects results/error, cleans up. func testSingle(t *testing.T, testName string, fkOnlineDDLPossible bool) { + if !strings.Contains(testName, testsFilter) { + t.Skipf("Skipping test %s due to filter: %s=%s", testName, testFilterEnvVar, testsFilter) + return + } if _, exists := readTestFile(t, testName, "require_rename_table_preserve_foreign_key"); exists { if !fkOnlineDDLPossible { t.Skipf("Skipping test due to require_rename_table_preserve_foreign_key")