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

Stop test as soon as expectation is verified #6891

Merged
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
Stop test as soon as expectations are ok
feloy committed Jun 14, 2023
commit b4528e9538de6cb160214f511a55a4399dc0e463
22 changes: 3 additions & 19 deletions tests/integration/interactive_deploy_test.go
Original file line number Diff line number Diff line change
@@ -157,28 +157,12 @@ var _ = Describe("odo deploy interactive command tests", func() {
})

It("should not fail but fallback to the interactive mode", func() {
output, err := helper.RunInteractive([]string{"odo", "deploy"}, nil, func(ctx helper.InteractiveContext) {
_, err := helper.RunInteractive([]string{"odo", "deploy"}, nil, func(ctx helper.InteractiveContext) {
helper.ExpectString(ctx, "Could not determine a Devfile based on the files in the current directory")

helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "PHP")

helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Enter component name")
helper.SendLine(ctx, "my-php-app")

helper.ExpectString(ctx, "no default deploy command found in devfile")
ctx.StopCommand()
})

Expect(err).To(Not(BeNil()))
Expect(output).ShouldNot(ContainSubstring("Which starter project do you want to use"))
Expect(output).To(ContainSubstring("no default deploy command found in devfile"))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElement("devfile.yaml"))
Expect(err).Should(HaveOccurred())
})
})
})
20 changes: 3 additions & 17 deletions tests/integration/interactive_init_test.go
Original file line number Diff line number Diff line change
@@ -653,27 +653,13 @@ var _ = Describe("odo init interactive command tests", func() {
})

It("should not fail but fallback to the interactive mode", func() {
output, err := helper.RunInteractive([]string{"odo", "init"}, nil, func(ctx helper.InteractiveContext) {
_, err := helper.RunInteractive([]string{"odo", "init"}, nil, func(ctx helper.InteractiveContext) {
helper.ExpectString(ctx, "Could not determine a Devfile based on the files in the current directory")

helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "PHP")

helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")

helper.ExpectString(ctx, "Enter component name")
helper.SendLine(ctx, "my-php-app")

helper.ExpectString(ctx, "Your new component 'my-php-app' is ready in the current directory")
ctx.StopCommand()
})

Expect(err).ShouldNot(HaveOccurred())
Expect(output).ShouldNot(ContainSubstring("Which starter project do you want to use"))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElement("devfile.yaml"))
Expect(err).Should(HaveOccurred())
})
})
})