Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flakes: Delete VTDATAROOT files in reparent test teardown within CI #13793

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion go/test/endtoend/reparent/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,25 @@ func SetupRangeBasedCluster(ctx context.Context, t *testing.T) *cluster.LocalPro
return setupCluster(ctx, t, ShardName, []string{cell1}, []int{2}, "semi_sync")
}

// TeardownCluster is used to teardown the reparent cluster
// TeardownCluster is used to teardown the reparent cluster. When
// run in a CI environment -- which is considered true when the
// "CI" env variable is set to "true" -- the teardown also removes
// the VTDATAROOT directory that was used for the test/cluster.
func TeardownCluster(clusterInstance *cluster.LocalProcessCluster) {
usedRoot := clusterInstance.CurrentVTDATAROOT
clusterInstance.Teardown()
// This is always set to "true" on GitHub Actions runners:
// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
ci, ok := os.LookupEnv("CI")
if !ok || strings.ToLower(ci) != "true" {
// Leave the directory in place to support local debugging.
return
}
// We're running in the CI, so free up disk space for any
// subsequent tests.
if err := os.RemoveAll(usedRoot); err != nil {
log.Errorf("Failed to remove previously used VTDATAROOT (%s): %v", usedRoot, err)
}
}

func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []string, numTablets []int, durability string) *cluster.LocalProcessCluster {
Expand Down