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
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
22 changes: 3 additions & 19 deletions tests/integration/interactive_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,12 @@ var _ = Describe("odo deploy interactive command tests", func() {
})

It("should not fail but fallback to the interactive mode", func() {
rm3l marked this conversation as resolved.
Show resolved Hide resolved
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())
})
})
})
Expand Down
20 changes: 3 additions & 17 deletions tests/integration/interactive_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
})
})
Expand Down