Skip to content

Commit

Permalink
test: TestStandbyCantSync move db uid before stop
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sgotti committed Jan 25, 2018
1 parent b2decba commit 8d24356
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/integration/ha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 8d24356

Please sign in to comment.