Fix some flaky tests (#5586)

* Eventually after delete component

* Fix for ps -ef error
This commit is contained in:
Philippe Martin
2022-03-25 08:11:15 +01:00
committed by GitHub
parent 2ba8ef007f
commit bad34a9f18
3 changed files with 11 additions and 4 deletions

View File

@@ -97,10 +97,12 @@ ComponentSettings:
// wait until the resources are deleted from the first delete
Eventually(string(commonVar.CliRunner.Run(getDeployArgs...).Out.Contents()), 60, 3).ShouldNot(ContainSubstring(deploymentName))
Eventually(string(commonVar.CliRunner.Run(getSVCArgs...).Out.Contents()), 60, 3).ShouldNot(ContainSubstring(serviceName))
stdOut = helper.Cmd("odo", "delete", "component", "--name", cmpName, "--namespace", commonVar.Project, "-f").ShouldPass().Out()
})
It("should output that there are no resources to be deleted", func() {
Expect(stdOut).To(ContainSubstring("No resource found for component %q in namespace %q", cmpName, commonVar.Project))
Eventually(func() string {
stdOut = helper.Cmd("odo", "delete", "component", "--name", cmpName, "--namespace", commonVar.Project, "-f").ShouldPass().Out()
return stdOut
}, 60, 3).Should(ContainSubstring("No resource found for component %q in namespace %q", cmpName, commonVar.Project))
})
})
})

View File

@@ -180,6 +180,10 @@ var _ = Describe("odo dev command tests", func() {
output := commonVar.CliRunner.Run("get", "deployment", "-n", commonVar.Project).Err.Contents()
Expect(string(output)).To(ContainSubstring("No resources found in " + commonVar.Project + " namespace."))
Eventually(func() string {
return string(commonVar.CliRunner.Run("get", "pods", "-n", commonVar.Project).Err.Contents())
}).Should(ContainSubstring("No resources found"))
otherNS = commonVar.CliRunner.CreateAndSetRandNamespaceProject()
})

View File

@@ -700,7 +700,8 @@ var _ = Describe("odo devfile push command tests", func() {
podName,
"runtime",
commonVar.Project,
[]string{"ps", "-ef"},
// [s] to not match the current command: https://unix.stackexchange.com/questions/74185/how-can-i-prevent-grep-from-showing-up-in-ps-results
[]string{"bash", "-c", "grep [s]pring-boot:run /proc/*/cmdline"},
func(cmdOp string, err error) bool {
cmdOutput = cmdOp
statErr = err
@@ -708,7 +709,7 @@ var _ = Describe("odo devfile push command tests", func() {
},
)
Expect(statErr).ToNot(HaveOccurred())
Expect(cmdOutput).To(ContainSubstring("spring-boot:run"))
Expect(cmdOutput).To(MatchRegexp("Binary file .* matches"))
})
})