diff --git a/pkg/init/mock.go b/pkg/init/mock.go index 6fcb8f24362..208d7443cdf 100644 --- a/pkg/init/mock.go +++ b/pkg/init/mock.go @@ -125,13 +125,14 @@ func (mr *MockClientMockRecorder) PersonalizeName(devfile, flags interface{}) *g } // SelectAndPersonalizeDevfile mocks base method. -func (m *MockClient) SelectAndPersonalizeDevfile(flags map[string]string, contextDir string) (parser.DevfileObj, string, error) { +func (m *MockClient) SelectAndPersonalizeDevfile(flags map[string]string, contextDir string) (parser.DevfileObj, string, *api.DevfileLocation, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SelectAndPersonalizeDevfile", flags, contextDir) ret0, _ := ret[0].(parser.DevfileObj) ret1, _ := ret[1].(string) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 + ret2, _ := ret[2].(*api.DevfileLocation) + ret3, _ := ret[3].(error) + return ret0, ret1, ret2, ret3 } // SelectAndPersonalizeDevfile indicates an expected call of SelectAndPersonalizeDevfile. diff --git a/pkg/kclient/mock_Client.go b/pkg/kclient/mock_Client.go index 03083ff33d9..aa41574abfe 100644 --- a/pkg/kclient/mock_Client.go +++ b/pkg/kclient/mock_Client.go @@ -328,20 +328,6 @@ func (mr *MockClientInterfaceMockRecorder) ExecCMDInContainer(containerName, pod return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecCMDInContainer", reflect.TypeOf((*MockClientInterface)(nil).ExecCMDInContainer), containerName, podName, cmd, stdout, stderr, stdin, tty) } -// ExtractProjectToComponent mocks base method. -func (m *MockClientInterface) ExtractProjectToComponent(containerName, podName, targetPath string, stdin io.Reader) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExtractProjectToComponent", containerName, podName, targetPath, stdin) - ret0, _ := ret[0].(error) - return ret0 -} - -// ExtractProjectToComponent indicates an expected call of ExtractProjectToComponent. -func (mr *MockClientInterfaceMockRecorder) ExtractProjectToComponent(containerName, podName, targetPath, stdin interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExtractProjectToComponent", reflect.TypeOf((*MockClientInterface)(nil).ExtractProjectToComponent), containerName, podName, targetPath, stdin) -} - // GeneratePortForwardReq mocks base method. func (m *MockClientInterface) GeneratePortForwardReq(podName string) *rest.Request { m.ctrl.T.Helper() diff --git a/tests/integration/interactive_init_test.go b/tests/integration/interactive_init_test.go index ca6d301e779..0070a1e45b5 100644 --- a/tests/integration/interactive_init_test.go +++ b/tests/integration/interactive_init_test.go @@ -92,6 +92,36 @@ var _ = Describe("odo init interactive command tests", func() { Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml")) }) + It("should print automation command with proper values", func() { + command := []string{"odo", "init"} + starter := "go-starter" + componentName := "my-go-app" + devfileName := "go" + + output, err := helper.RunInteractive(command, nil, func(ctx helper.InteractiveContext) { + + helper.ExpectString(ctx, "Select language") + helper.SendLine(ctx, "Go") + + helper.ExpectString(ctx, "Select project type") + helper.SendLine(ctx, "") + + helper.ExpectString(ctx, "Which starter project do you want to use") + helper.SendLine(ctx, starter) + + helper.ExpectString(ctx, "Enter component name") + helper.SendLine(ctx, componentName) + + helper.ExpectString(ctx, "Your new component 'my-go-app' is ready in the current directory") + + }) + + Expect(err).To(BeNil()) + Expect(output).To(ContainSubstring("odo init --name %s --devfile %s --devfile-registry DefaultDevfileRegistry --starter %s", componentName, devfileName, starter)) + Expect(output).To(ContainSubstring("Your new component 'my-go-app' is ready in the current directory")) + Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml")) + }) + It("should download correct devfile", func() { command := []string{"odo", "init"}