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

ci: fix sporadic issue during rollout check #931

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions tests/e2e/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ var _ = Describe("E2E - Checking a simple application", Label("check-app"), func

By("Waiting for deployment to be rollout", func() {
// Wait for application to be started
status, err := kubectl.Run("rollout", "status", "deployment/"+appName)
Expect(err).To(Not(HaveOccurred()))
Expect(status).To(ContainSubstring("successfully rolled out"))
// NOTE: 1st or 2nd rollout command can sporadically fail, so better to use Eventually here
Eventually(func() string {
status, _ := kubectl.Run("rollout", "status", "deployment/"+appName)
return status
}, tools.SetTimeout(2*time.Minute), 30*time.Second).Should(ContainSubstring("successfully rolled out"))
})

By("Checking application", func() {
Expand Down
33 changes: 18 additions & 15 deletions tests/e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,31 @@ var _ = Describe("E2E - Upgrading Rancher Manager", Label("upgrade-rancher-manag
Expect(err).To(Not(HaveOccurred()))

// Wait for Rancher Manager to be restarted
status, err := kubectl.Run(
"rollout",
"--namespace", "cattle-system",
"status", "deployment/rancher",
)
Expect(err).To(Not(HaveOccurred()))
Expect(status).To(ContainSubstring("successfully rolled out"))
// NOTE: 1st or 2nd rollout command can sporadically fail, so better to use Eventually here
Eventually(func() string {
status, _ := kubectl.Run(
"rollout",
"--namespace", "cattle-system",
"status", "deployment/rancher",
)
return status
}, tools.SetTimeout(2*time.Minute), 30*time.Second).Should(ContainSubstring("successfully rolled out"))

// Check that all Rancher Manager pods are running
checkList := [][]string{
{"cattle-system", "app=rancher"},
{"cattle-fleet-local-system", "app=fleet-agent"},
{"cattle-system", "app=rancher-webhook"},
}
err = rancher.CheckPod(k, checkList)
Expect(err).To(Not(HaveOccurred()))
Eventually(func() error {
checkList := [][]string{
{"cattle-system", "app=rancher"},
{"cattle-fleet-local-system", "app=fleet-agent"},
{"cattle-system", "app=rancher-webhook"},
}
return rancher.CheckPod(k, checkList)
}, tools.SetTimeout(3*time.Minute), 10*time.Second).Should(Not(HaveOccurred()))

// Check that all pods are using the same version
Eventually(func() int {
out, _ := kubectl.Run(getImageVersion...)
return len(strings.Fields(out))
}, tools.SetTimeout(3*time.Minute), 5*time.Second).Should(Equal(1))
}, tools.SetTimeout(3*time.Minute), 10*time.Second).Should(Equal(1))

// Get after-upgrade Rancher Manager version
// and check that it's different to the before-upgrade version
Expand Down