From 5f3aed25b32b90bd6140df4a980b7ebc471dc43f Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Fri, 17 Nov 2023 21:51:15 +0100 Subject: [PATCH] Fix regression where the test cluster was not setting the primary correctly Signed-off-by: Rohit Nayak --- go/test/endtoend/cluster/vttablet_process.go | 1 + go/test/endtoend/vreplication/cluster_test.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/test/endtoend/cluster/vttablet_process.go b/go/test/endtoend/cluster/vttablet_process.go index 0f3653371ab..f51e1838a5b 100644 --- a/go/test/endtoend/cluster/vttablet_process.go +++ b/go/test/endtoend/cluster/vttablet_process.go @@ -79,6 +79,7 @@ type VttabletProcess struct { DbFlavor string Charset string ConsolidationsURL string + IsPrimary bool // Extra Args to be set before starting the vttablet process ExtraArgs []string diff --git a/go/test/endtoend/vreplication/cluster_test.go b/go/test/endtoend/vreplication/cluster_test.go index 784fcd870dd..89cebc7d0b1 100644 --- a/go/test/endtoend/vreplication/cluster_test.go +++ b/go/test/endtoend/vreplication/cluster_test.go @@ -544,6 +544,7 @@ func (vc *VitessCluster) AddShards(t *testing.T, cells []*Cell, keyspace *Keyspa tablets = append(tablets, primary) dbProcesses = append(dbProcesses, proc) primaryTabletUID = primary.Vttablet.TabletUID + primary.Vttablet.IsPrimary = true } for i := 0; i < numReplicas; i++ { @@ -795,7 +796,7 @@ func (vc *VitessCluster) getPrimaryTablet(t *testing.T, ksName, shardName string continue } for _, tablet := range shard.Tablets { - if strings.EqualFold(tablet.Vttablet.TabletType, "primary") { + if tablet.Vttablet.IsPrimary { return tablet.Vttablet } }