Skip to content

Commit 5aa3b11

Browse files
committed
Allow for different MySQL versions
Signed-off-by: Dirkjan Bussink <[email protected]>
1 parent cb8ee92 commit 5aa3b11

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

go/vt/mysqlctl/replication_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"math"
2323
"net"
24+
"strings"
2425
"testing"
2526
"time"
2627

@@ -287,6 +288,7 @@ func TestPrimaryStatus(t *testing.T) {
287288

288289
db.AddQuery("SELECT 1", &sqltypes.Result{})
289290
db.AddQuery("SHOW MASTER STATUS", sqltypes.MakeTestResult(sqltypes.MakeTestFields("test_field", "varchar"), "test_status"))
291+
db.AddQuery("SHOW BINARY LOG STATUS", sqltypes.MakeTestResult(sqltypes.MakeTestFields("test_field", "varchar"), "test_status"))
290292
db.AddQuery("SELECT @@global.server_uuid", sqltypes.MakeTestResult(sqltypes.MakeTestFields("test_field", "varchar"), "test_uuid"))
291293

292294
testMysqld := NewMysqld(dbc)
@@ -299,6 +301,7 @@ func TestPrimaryStatus(t *testing.T) {
299301
assert.EqualValues(t, "test_uuid", res.ServerUUID)
300302

301303
db.AddQuery("SHOW MASTER STATUS", &sqltypes.Result{})
304+
db.AddQuery("SHOW BINARY LOG STATUS", &sqltypes.Result{})
302305
_, err = testMysqld.PrimaryStatus(ctx)
303306
assert.ErrorContains(t, err, "no master status")
304307
}
@@ -379,6 +382,7 @@ func TestSetReplicationPosition(t *testing.T) {
379382

380383
db.AddQuery("SELECT 1", &sqltypes.Result{})
381384
db.AddQuery("RESET MASTER", &sqltypes.Result{})
385+
db.AddQuery("RESET BINARY LOGS AND GTIDS", &sqltypes.Result{})
382386

383387
testMysqld := NewMysqld(dbc)
384388
defer testMysqld.Close()
@@ -409,6 +413,7 @@ func TestSetReplicationSource(t *testing.T) {
409413

410414
db.AddQuery("SELECT 1", &sqltypes.Result{})
411415
db.AddQuery("RESET MASTER", &sqltypes.Result{})
416+
db.AddQuery("RESET BINARY LOGS AND GTIDS", &sqltypes.Result{})
412417
db.AddQuery("STOP REPLICA", &sqltypes.Result{})
413418

414419
testMysqld := NewMysqld(dbc)
@@ -445,10 +450,12 @@ func TestResetReplication(t *testing.T) {
445450
// We expect this query to be executed
446451
db.AddQuery("RESET REPLICA ALL", &sqltypes.Result{})
447452
err = testMysqld.ResetReplication(ctx)
448-
assert.ErrorContains(t, err, "RESET MASTER")
453+
require.Error(t, err)
454+
require.True(t, strings.Contains(err.Error(), "RESET MASTER") || strings.Contains(err.Error(), "RESET BINARY LOGS AND GTIDS"))
449455

450456
// We expect this query to be executed
451457
db.AddQuery("RESET MASTER", &sqltypes.Result{})
458+
db.AddQuery("RESET BINARY LOGS AND GTIDS", &sqltypes.Result{})
452459
err = testMysqld.ResetReplication(ctx)
453460
assert.NoError(t, err)
454461
}

0 commit comments

Comments
 (0)