Skip to content

Commit

Permalink
A couple endtoend cluster tests enhancement (#17247)
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Nov 25, 2024
1 parent ebf321e commit 96f4ac7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion go/test/endtoend/cluster/vtctldclient_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type VtctldClientProcess struct {
TempDirectory string
ZoneName string
VtctldClientMajorVersion int
Quiet bool
}

// ExecuteCommand executes any vtctldclient command
Expand Down Expand Up @@ -72,7 +73,9 @@ func (vtctldclient *VtctldClientProcess) ExecuteCommandWithOutput(args ...string
filterDoubleDashArgs(pArgs, vtctldclient.VtctldClientMajorVersion)...,
)
msg := binlogplayer.LimitString(strings.Join(tmpProcess.Args, " "), 256) // limit log line length
log.Infof("Executing vtctldclient with command: %v (attempt %d of %d)", msg, i+1, retries)
if !vtctldclient.Quiet {
log.Infof("Executing vtctldclient with command: %v (attempt %d of %d)", msg, i+1, retries)
}
resultByte, err = tmpProcess.CombinedOutput()
resultStr = string(resultByte)
if err == nil || !shouldRetry(resultStr) {
Expand Down
10 changes: 10 additions & 0 deletions go/test/endtoend/cluster/vttablet_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,16 @@ func (vttablet *VttabletProcess) QueryTablet(query string, keyspace string, useD
return executeQuery(conn, query)
}

// MultiQueryTablet lets you execute a query in this tablet and get the result
func (vttablet *VttabletProcess) MultiQueryTablet(sql string, keyspace string, useDb bool) error {
conn, err := vttablet.TabletConn(keyspace, useDb)
if err != nil {
return err
}
defer conn.Close()
return executeMultiQuery(conn, sql)
}

// SemiSyncExtensionLoaded returns what type of semi-sync extension is loaded
func (vttablet *VttabletProcess) SemiSyncExtensionLoaded() (mysql.SemiSyncType, error) {
conn, err := vttablet.TabletConn("", false)
Expand Down

0 comments on commit 96f4ac7

Please sign in to comment.