Skip to content

Commit

Permalink
Stop test as soon as expectations are ok (#6891)
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy authored Jun 15, 2023
1 parent 63c8e27 commit 24db607
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 36 deletions.
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() {
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

0 comments on commit 24db607

Please sign in to comment.