Make runTransit tolerate a non-core-0 leader. (#9548)
This commit is contained in:
parent
66c8032fb5
commit
3fbc0f35c2
|
@ -729,9 +729,9 @@ func runTransit(t *testing.T, logger hclog.Logger, storage teststorage.ReusableS
|
|||
storage.Cleanup(t, cluster)
|
||||
}()
|
||||
|
||||
leader := cluster.Cores[0]
|
||||
client := leader.Client
|
||||
client.SetToken(rootToken)
|
||||
for _, c := range cluster.Cores {
|
||||
c.Client.SetToken(rootToken)
|
||||
}
|
||||
|
||||
// Unseal. Even though we are using autounseal, we have to unseal
|
||||
// explicitly because we are using SkipInit.
|
||||
|
@ -742,7 +742,8 @@ func runTransit(t *testing.T, logger hclog.Logger, storage teststorage.ReusableS
|
|||
// This is apparently necessary for the raft cluster to get itself
|
||||
// situated.
|
||||
time.Sleep(15 * time.Second)
|
||||
if err := testhelpers.VerifyRaftConfiguration(leader, len(cluster.Cores)); err != nil {
|
||||
// We're taking the first core, but we're not assuming it's the leader here.
|
||||
if err := testhelpers.VerifyRaftConfiguration(cluster.Cores[0], len(cluster.Cores)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
|
@ -752,6 +753,11 @@ func runTransit(t *testing.T, logger hclog.Logger, storage teststorage.ReusableS
|
|||
}
|
||||
testhelpers.WaitForNCoresUnsealed(t, cluster, len(cluster.Cores))
|
||||
|
||||
// Preceding code may have stepped down the leader, so we're not sure who it is
|
||||
// at this point.
|
||||
leaderCore := testhelpers.DeriveActiveCore(t, cluster)
|
||||
client := leaderCore.Client
|
||||
|
||||
// Read the secrets
|
||||
secret, err := client.Logical().Read("kv-wrapped/foo")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue