-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Acceptance test for Auto Reload Config #1135
Conversation
7c02b61
to
48e5885
Compare
@@ -264,7 +264,7 @@ func (c *CLICluster) SetupConsulClient(t *testing.T, secure bool) *api.Client { | |||
consulClient, err := api.NewClient(config) | |||
require.NoError(t, err) | |||
|
|||
return consulClient | |||
return consulClient, config.Address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now also returning the address so that we can dial it in the test to get the cert and check the expiration.
@@ -211,12 +211,38 @@ func (h *HelmCluster) Upgrade(t *testing.T, helmValues map[string]string) { | |||
k8s.WaitForAllPodsToBeReady(t, h.kubernetesClient, h.helmOptions.KubectlOptions.Namespace, fmt.Sprintf("release=%s", h.releaseName)) | |||
} | |||
|
|||
func (h *HelmCluster) SetupConsulClient(t *testing.T, secure bool) *api.Client { | |||
func (h *HelmCluster) CreatePortForwardTunnel(t *testing.T, remotePort int) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted this out so that we can set up a tunnel without having to get another client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
// TestVault_TlsAutoReload installs Vault, bootstraps it with secrets, policies, and Kube Auth Method. | ||
// It then gets certs for https and rpc on the server. It then waits for the certs to rotate and checks | ||
// that certs have different expirations. | ||
func TestVault_TlsAutoReload(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is essentially the TestVault() test, but we make the certificate expiration very short and then we also get HTTPS and RPC certs before and after the time we expect them to expire to confirm that they have been rotated, as indicated by a new NotAfter value.
|
||
// verify that a previous cert expired and that a new one has been issued | ||
// by comparing the NotAfter on the two certs. | ||
require.NotEqual(t, httpsCert.NotAfter, httpsCert2.NotAfter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the main assertion and how it differs from TestVault().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job John! I really like the change to the portforward tunnelling.
I only have a couple tiny questions/comments below
@@ -211,12 +211,38 @@ func (h *HelmCluster) Upgrade(t *testing.T, helmValues map[string]string) { | |||
k8s.WaitForAllPodsToBeReady(t, h.kubernetesClient, h.helmOptions.KubectlOptions.Namespace, fmt.Sprintf("release=%s", h.releaseName)) | |||
} | |||
|
|||
func (h *HelmCluster) SetupConsulClient(t *testing.T, secure bool) *api.Client { | |||
func (h *HelmCluster) CreatePortForwardTunnel(t *testing.T, remotePort int) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition!
@@ -194,7 +194,7 @@ func (c *CLICluster) Destroy(t *testing.T) { | |||
require.NoError(t, err) | |||
} | |||
|
|||
func (c *CLICluster) SetupConsulClient(t *testing.T, secure bool) *api.Client { | |||
func (c *CLICluster) SetupConsulClient(t *testing.T, secure bool) (*api.Client, string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name the returns so that the signature is clearer when looking up the function
`func (c *CLICluster) SetupConsulClient(t *testing.T, secure bool) (client *api.Client, configAddress string)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, John. A good quality of life improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job here John!!!
NOTE: This looks like more files at first glance but there are many files that changed because of a signature change to
SetupConsulClient
Changes proposed in this PR:
SetupConsulClient
to also return the portward addressHow I've tested this PR:
How I expect reviewers to test this PR:
Checklist: