Skip to content
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

Fix: Flaky tests for host-agent bootstrap flow #554

Merged
merged 1 commit into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions agent/host_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ var _ = Describe("Agent", func() {

output, _, err = runner.ExecByoDockerHost(byoHostContainer)
Expect(err).NotTo(HaveOccurred())
// Clean for any CSR present
var csrList certv1.CertificateSigningRequestList
Expect(k8sClient.List(ctx, &csrList)).ShouldNot(HaveOccurred())
for _, csr := range csrList.Items {
Expect(k8sClient.Delete(ctx, &csr)).ShouldNot(HaveOccurred())
}
})

JustAfterEach(func() {
Expand All @@ -558,11 +564,6 @@ var _ = Describe("Agent", func() {
})

AfterEach(func() {
var csrList certv1.CertificateSigningRequestList
Expect(k8sClient.List(ctx, &csrList)).ShouldNot(HaveOccurred())
for _, csr := range csrList.Items {
Expect(k8sClient.Delete(ctx, &csr)).ShouldNot(HaveOccurred())
}
cleanup(runner.Context, byoHostContainer, ns, agentLogFile)
})

Expand Down Expand Up @@ -660,11 +661,6 @@ var _ = Describe("Agent", func() {
Expect(os.Remove(execLogFile)).ShouldNot(HaveOccurred())
})
It("should wait for the certificate to be issued", func() {
byohCSR, err := builder.CertificateSigningRequest(fmt.Sprintf(registration.ByohCSRNameFormat, hostName), fmt.Sprintf(registration.ByohCSRCNFormat, hostName), "byoh:hosts", 2048).Build()
Expect(err).NotTo(HaveOccurred())
// TODO: Check why AfterEach delete is not working
// nolint: errcheck
k8sClient.Delete(ctx, byohCSR)
defer output.Close()
f := e2e.WriteDockerLog(output, agentLogFile)
defer func() {
Expand Down