Add helper used in ent. (#10445)

This commit is contained in:
Nick Cabatoff 2020-11-25 08:27:45 -05:00 committed by GitHub
parent fa18497643
commit 6a377a3df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -280,6 +280,25 @@ func WaitForNCoresUnsealed(t testing.T, cluster *vault.TestCluster, n int) {
t.Fatalf("%d cores were not unsealed", n)
}
func SealCores(t testing.T, cluster *vault.TestCluster) {
t.Helper()
for _, core := range cluster.Cores {
if err := core.Shutdown(); err != nil {
t.Fatal(err)
}
timeout := time.Now().Add(3 * time.Second)
for {
if time.Now().After(timeout) {
t.Fatal("timeout waiting for core to seal")
}
if core.Sealed() {
break
}
time.Sleep(100 * time.Millisecond)
}
}
}
func WaitForNCoresSealed(t testing.T, cluster *vault.TestCluster, n int) {
t.Helper()
for i := 0; i < 60; i++ {