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

Flake: Attempt at fixing Personalize configuration #6830

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
83 changes: 35 additions & 48 deletions tests/integration/interactive_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,68 +92,55 @@ var _ = Describe("odo init interactive command tests", func() {
hasMultipleVersions = true
}
})
It("should allow for personalizing configurations", func() {
command := []string{"odo", "init"}
output, err := helper.RunInteractive(command, nil, func(ctx helper.InteractiveContext) {

helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Javascript")
Context("personalizing configuration", func() {
It("should allow to add and delete a port ", func() {
command := []string{"odo", "init"}
output, err := helper.RunInteractive(command, nil, func(ctx helper.InteractiveContext) {

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

if hasMultipleVersions {
helper.ExpectString(ctx, "Select version")
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
}

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

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new port")

helper.ExpectString(ctx, "Enter port number:")
helper.SendLine(ctx, "5000")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete port \"3000\"")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new environment variable")
if hasMultipleVersions {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}

helper.ExpectString(ctx, "Enter new environment variable name:")
helper.SendLine(ctx, "DEBUG_PROJECT_PORT")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.ExpectString(ctx, "runtime")
helper.SendLine(ctx, "runtime")

helper.ExpectString(ctx, "Enter value for \"DEBUG_PROJECT_PORT\" environment variable:")
helper.SendLine(ctx, "5858")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete port \"3000\"")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete environment variable \"DEBUG_PORT\"")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new port")
helper.ExpectString(ctx, "Enter port number:")
helper.SendLine(ctx, "3000")

helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "NOTHING - configuration is correct")
helper.ExpectString(ctx, "What configuration do you want change")
// Default option is NOTHING - configuration is correct
helper.SendLine(ctx, "")

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

helper.ExpectString(ctx, "Which starter project do you want to use")
helper.SendLine(ctx, "nodejs-starter")
helper.ExpectString(ctx, "Which starter project do you want to use")
helper.SendLine(ctx, "nodejs-starter")

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

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

})
Expect(err).To(BeNil())
Expect(output).To(ContainSubstring("Your new component 'my-nodejs-app' is ready in the current directory."))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
helper.FileShouldContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "3000")
})
Expect(err).To(BeNil())
Expect(output).To(ContainSubstring("Your new component 'my-nodejs-app' is ready in the current directory."))
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
helper.FileShouldContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "5000")
helper.FileShouldNotContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "3000")
helper.FileShouldContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "DEBUG_PROJECT_PORT")
helper.FileShouldNotContainSubstring(filepath.Join(commonVar.Context, "devfile.yaml"), "DEBUG_PORT")
})
})

Expand Down