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

Move vreplication to vitess json parser #12761

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Flaky TestRestart: give mysqlctld process time to shutdown (#12799)
* Give mysqlctld time to shutdown properly before restarting to account for delays in CI

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

---------

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
  • Loading branch information
rohit-nayak-ps committed Apr 3, 2023
commit a8f474a3dd5e3dd59e953336fbda0f47a10ab894
5 changes: 5 additions & 0 deletions go/test/endtoend/cluster/mysqlctld_process.go
Original file line number Diff line number Diff line change
@@ -168,3 +168,8 @@ func (mysqlctld *MysqlctldProcess) IsHealthy() bool {
_, err := mysql.Connect(context.Background(), &params)
return err == nil
}

// HasShutdown checks if the process has been set to nil
func (mysqlctld *MysqlctldProcess) HasShutdown() bool {
return mysqlctld.process == nil
}
21 changes: 21 additions & 0 deletions go/test/endtoend/mysqlctld/mysqlctld_test.go
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import (
"fmt"
"os"
"testing"
"time"

"github.com/stretchr/testify/require"

@@ -134,10 +135,30 @@ func initCluster(shardNames []string, totalTabletsRequired int) error {
return nil
}

const defaultOperationTimeout = 300 * time.Second
const defaultRetryDelay = 3 * time.Second

func waitForMysqlctldShutdown(t *testing.T, tab *cluster.Vttablet) bool {
tmr := time.NewTimer(defaultOperationTimeout)
defer tmr.Stop()
for {
if tab.MysqlctldProcess.HasShutdown() {
return true
}
select {
case <-tmr.C:
return false
default:
}
time.Sleep(defaultRetryDelay)
}
}

func TestRestart(t *testing.T) {
defer cluster.PanicHandler(t)
err := primaryTablet.MysqlctldProcess.Stop()
require.Nil(t, err)
require.Truef(t, waitForMysqlctldShutdown(t, primaryTablet), "Mysqlctld has not stopped after %s", defaultOperationTimeout)
primaryTablet.MysqlctldProcess.CleanupFiles(primaryTablet.TabletUID)
err = primaryTablet.MysqlctldProcess.Start()
require.Nil(t, err)