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

Flaky Migrate e2e tests: try explicitly killing processes before setting up new cluster #17394

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions go/test/endtoend/vreplication/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,19 @@ func (vc *VitessCluster) startQuery(t *testing.T, query string) (func(t *testing
return commit, rollback
}

func killBinaries() {
binaries := []string{"mysqld_safe", "mysqld", "etcd", "mysqlctl", "mysqlctld", "vtgate", "vttablet", "vtctld", "vtctl", "vtorc"}
for _, bin := range binaries {
cmd := exec.Command("pkill", fmt.Sprintf(".*%s.*", bin))
err := cmd.Run()
if err != nil {
log.Infof("Error killing %s: %v", bin, err)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log lines are for checking if we have residual processes. If this works we can remove the log lines asap.

} else {
log.Infof("Killed %s", bin)
}
}
}

// setupDBTypeVersion will perform any work needed to enable a specific
// database type and version if not already installed. It returns a
// function to reset any environment changes made.
Expand Down
3 changes: 3 additions & 0 deletions go/test/endtoend/vreplication/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func insertInitialDataIntoExternalCluster(t *testing.T, conn *mysql.Conn) {
// hence the VTDATAROOT env variable gets overwritten.
// Each time we need to create vt processes in the "other" cluster we need to set the appropriate VTDATAROOT
func TestVtctlMigrate(t *testing.T) {
killBinaries()
vc = NewVitessCluster(t, nil)

oldDefaultReplicas := defaultReplicas
Expand Down Expand Up @@ -175,6 +176,7 @@ func TestVtctlMigrate(t *testing.T) {
// hence the VTDATAROOT env variable gets overwritten.
// Each time we need to create vt processes in the "other" cluster we need to set the appropriate VTDATAROOT
func TestVtctldMigrateUnsharded(t *testing.T) {
killBinaries()
vc = NewVitessCluster(t, nil)

oldDefaultReplicas := defaultReplicas
Expand Down Expand Up @@ -320,6 +322,7 @@ func TestVtctldMigrateUnsharded(t *testing.T) {
// doesn't match that of the source cluster. The test migrates from a cluster with keyspace customer to an "external"
// cluster with keyspace rating.
func TestVtctldMigrateSharded(t *testing.T) {
killBinaries()
setSidecarDBName("_vt")
currentWorkflowType = binlogdatapb.VReplicationWorkflowType_MoveTables
oldDefaultReplicas := defaultReplicas
Expand Down
Loading