From 8d24356d27219d30907f2d5e05fe7e842efc35e4 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Thu, 25 Jan 2018 17:21:08 +0100 Subject: [PATCH] test: TestStandbyCantSync move db uid before stop Get the standby[0] db uid before stopping it or we can end up reading the new db uid if the sentinel was faster then us replacing the old db uid. --- tests/integration/ha_test.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/integration/ha_test.go b/tests/integration/ha_test.go index 7d2f188fe..57d5285da 100644 --- a/tests/integration/ha_test.go +++ b/tests/integration/ha_test.go @@ -1638,6 +1638,19 @@ func TestStandbyCantSync(t *testing.T) { t.Fatalf("unexpected err: %v", err) } + // get current stanbdys[0] db uid + cd, _, err := sm.GetClusterData(context.TODO()) + if err != nil { + t.Fatalf("unexpected err: %v", err) + } + + var standby0DBUID string + for _, db := range cd.DBs { + if db.Spec.KeeperUID == standbys[0].uid { + standby0DBUID = db.UID + } + } + // stop standbys[0] t.Logf("Stopping standbys[0] keeper: %s", standbys[0].uid) standbys[0].Stop() @@ -1663,19 +1676,6 @@ func TestStandbyCantSync(t *testing.T) { t.Fatalf("unexpected err: %v", err) } - // get current stanbdys[0] db uid - cd, _, err := sm.GetClusterData(context.TODO()) - if err != nil { - t.Fatalf("unexpected err: %v", err) - } - - var standby0DBUID string - for _, db := range cd.DBs { - if db.Spec.KeeperUID == standbys[0].uid { - standby0DBUID = db.UID - } - } - // start standbys[0] t.Logf("Starting standbys[0] keeper: %s", standbys[0].uid) standbys[0].Start()