Allow time for secondary CA to initialize (#6627)

This commit is contained in:
Paul Banks 2019-10-16 17:03:31 +01:00 committed by GitHub
parent f9a43a1e2d
commit 979ad7fecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -262,8 +262,6 @@ func TestLeader_SecondaryCA_IntermediateRefresh(t *testing.T) {
func TestLeader_SecondaryCA_FixSigningKeyID_via_IntermediateRefresh(t *testing.T) { func TestLeader_SecondaryCA_FixSigningKeyID_via_IntermediateRefresh(t *testing.T) {
t.Parallel() t.Parallel()
require := require.New(t)
dir1, s1 := testServerWithConfig(t, func(c *Config) { dir1, s1 := testServerWithConfig(t, func(c *Config) {
c.Build = "1.6.0" c.Build = "1.6.0"
}) })
@ -288,6 +286,8 @@ func TestLeader_SecondaryCA_FixSigningKeyID_via_IntermediateRefresh(t *testing.T
// Restore the pre-1.6.1 behavior of the SigningKeyID not being derived // Restore the pre-1.6.1 behavior of the SigningKeyID not being derived
// from the intermediates. // from the intermediates.
{ {
require := require.New(t)
state := s2pre.fsm.State() state := s2pre.fsm.State()
// Get the highest index // Get the highest index
@ -335,7 +335,13 @@ func TestLeader_SecondaryCA_FixSigningKeyID_via_IntermediateRefresh(t *testing.T
testrpc.WaitForLeader(t, s2.RPC, "dc2") testrpc.WaitForLeader(t, s2.RPC, "dc2")
{ // verify that the root is now corrected // Retry since it will take some time to init the secondary CA fully and there
// isn't a super clean way to watch specifically until it's done than polling
// the CA provider anyway.
retry.Run(t, func(r *retry.R) {
require := require.New(r)
// verify that the root is now corrected
provider, activeRoot := s2.getCAProvider() provider, activeRoot := s2.getCAProvider()
require.NotNil(provider) require.NotNil(provider)
require.NotNil(activeRoot) require.NotNil(activeRoot)
@ -349,7 +355,7 @@ func TestLeader_SecondaryCA_FixSigningKeyID_via_IntermediateRefresh(t *testing.T
// Force this to be derived just from the root, not the intermediate. // Force this to be derived just from the root, not the intermediate.
expect := connect.EncodeSigningKeyID(intermediateCert.SubjectKeyId) expect := connect.EncodeSigningKeyID(intermediateCert.SubjectKeyId)
require.Equal(expect, activeRoot.SigningKeyID) require.Equal(expect, activeRoot.SigningKeyID)
} })
} }
func TestLeader_SecondaryCA_TransitionFromPrimary(t *testing.T) { func TestLeader_SecondaryCA_TransitionFromPrimary(t *testing.T) {