Skip to content

Commit

Permalink
Run Devfile personalization in interactive mode from empty directory (#…
Browse files Browse the repository at this point in the history
…6351)

* run Devfile personilization from empty directory

run Devfile personilization in interactive mode from empty directory

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* updating e2e tests accordingly

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
  • Loading branch information
anandrkskd authored Nov 30, 2022
1 parent f079c3c commit 3e81c10
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,9 @@ func (o *InitClient) PersonalizeName(devfile parser.DevfileObj, flags map[string

func (o InitClient) PersonalizeDevfileConfig(devfileobj parser.DevfileObj, flags map[string]string, fs filesystem.Filesystem, dir string) (parser.DevfileObj, error) {
var backend backend.InitBackend
onlyDevfile, err := location.DirContainsOnlyDevfile(fs, dir)
if err != nil {
return parser.DevfileObj{}, err
}

// Interactive mode since no flags are provided
if len(flags) == 0 && !onlyDevfile {
// Other files present in the directory; hence alizer is run
if len(flags) == 0 {
backend = o.interactiveBackend
} else {
backend = o.flagsBackend
Expand Down
3 changes: 3 additions & 0 deletions tests/e2escenarios/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ var _ = Describe("E2E Test", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "Node.js")

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")

Expand Down
21 changes: 21 additions & 0 deletions tests/integration/interactive_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
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, "Which starter project do you want to use")
helper.SendLine(ctx, "")

Expand All @@ -76,6 +79,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
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, "Which starter project do you want to use")
helper.SendLine(ctx, "")

Expand Down Expand Up @@ -113,6 +119,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
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, "Which starter project do you want to use")
helper.SendLine(ctx, starter)

Expand Down Expand Up @@ -144,6 +153,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
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, "Which starter project do you want to use")
helper.SendLine(ctx, "")

Expand Down Expand Up @@ -174,6 +186,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "Vert.x Java")

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, "vertx-cache-example-redhat")

Expand Down Expand Up @@ -265,6 +280,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
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, "Which starter project do you want to use")
helper.SendLine(ctx, "")
})
Expand Down Expand Up @@ -414,6 +432,9 @@ var _ = Describe("odo init interactive command tests", Label(helper.LabelNoClust
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, "Which starter project do you want to use")
helper.SendLine(ctx, "")

Expand Down

0 comments on commit 3e81c10

Please sign in to comment.