Flake: Attempt at fixing Personalize configuration (#6830)

* Flake: Attempt at fixing Personalize configuration

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Separate the tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Another attempt

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* another attempt

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Remove env var test; already covered in e2e tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Update tests/helper/helper_interactive.go

---------

Signed-off-by: Parthvi Vala <pvala@redhat.com>
This commit is contained in:
Parthvi Vala
2023-06-29 20:15:45 +05:30
committed by GitHub
parent 6a4e964d5e
commit a10f693fa7

View File

@@ -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) {
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 language")
helper.SendLine(ctx, "Javascript")
helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Javascript")
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
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")
if hasMultipleVersions {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Add new 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 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, "Delete port \"3000\"")
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, "Add new environment variable")
helper.ExpectString(ctx, "What configuration do you want change")
// Default option is NOTHING - configuration is correct
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.SendLine(ctx, "")
helper.ExpectString(ctx, "Enter value for \"DEBUG_PROJECT_PORT\" environment variable:")
helper.SendLine(ctx, "5858")
helper.ExpectString(ctx, "Which starter project do you want to use")
helper.SendLine(ctx, "nodejs-starter")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete environment variable \"DEBUG_PORT\"")
helper.ExpectString(ctx, "Enter component name:")
helper.SendLine(ctx, "my-nodejs-app")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "NOTHING - configuration is correct")
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, "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")
})
})