Skip to content

Commit

Permalink
Wait for the host agent process to start
Browse files Browse the repository at this point in the history
Since we are running the host agent in the containers for integration
tests, the process is not started instantly sometimes and this causes
flakes in the tests. Adding a check to ensure the host agent process is
started and only then proceed with the tests

Signed-off-by: Nilanjan Daw <[email protected]>
  • Loading branch information
anusha94 authored and Nilanjan Daw committed Mar 21, 2022
1 parent 3e0b04f commit c0f644b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion agent/host_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ var _ = Describe("Agent", func() {

output, _, err = runner.ExecByoDockerHost(byoHostContainer)
Expect(err).NotTo(HaveOccurred())

// wait until the agent process starts inside the byoh host container
Eventually(func() bool {
containerTop, _ := runner.DockerClient.ContainerTop(ctx, byoHostContainer.ID, []string{})
for _, proc := range containerTop.Processes {
if strings.Contains(proc[len(containerTop.Titles)-1], "agent") {
return true
}

}
return false
}).Should(BeTrue())
})

AfterEach(func() {
Expand Down Expand Up @@ -313,7 +325,7 @@ var _ = Describe("Agent", func() {
}
}
return corev1.ConditionFalse
}, 60).Should(Equal(corev1.ConditionTrue))
}, 100).Should(Equal(corev1.ConditionTrue)) // installing K8s components is a lengthy operation, setting the timeout to 100s
})
})
})
Expand Down

0 comments on commit c0f644b

Please sign in to comment.