Skip to content

Commit

Permalink
pd-ctl: make TestShowKeyspaceGroupPrimary stable (tikv#6903)
Browse files Browse the repository at this point in the history
close tikv#6783

Signed-off-by: lhy1024 <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
lhy1024 and ti-chi-bot[bot] authored Aug 8, 2023
1 parent ebd2cfe commit a605e11
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/pdctl/keyspace/keyspace_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,13 @@ func TestShowKeyspaceGroupPrimary(t *testing.T) {
args := []string{"-u", pdAddr, "keyspace-group"}
output, err := pdctl.ExecuteCommand(cmd, append(args, "1")...)
re.NoError(err)
if strings.Contains(string(output), "Failed") {
// It may be failed when meets error, such as [PD:etcd:ErrEtcdTxnConflict]etcd transaction failed, conflicted and rolled back
re.Contains(string(output), "ErrEtcdTxnConflict", "output: %s", string(output))
return false
}
err = json.Unmarshal(output, &keyspaceGroup)
re.NoErrorf(err, "output: %s", string(output))
re.NoError(err)
return len(keyspaceGroup.Members) == 2
})
for _, member := range keyspaceGroup.Members {
Expand Down

0 comments on commit a605e11

Please sign in to comment.