Skip to content

Commit

Permalink
A couple changes in Online DDL CI (#16272)
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Jul 3, 2024
1 parent 3db70b6 commit de39000
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand All @@ -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)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit de39000

Please sign in to comment.