From 7849f20a9f2347c03afb1e9d9e767a306a6e4586 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Wed, 25 Jan 2023 16:27:15 +0530 Subject: [PATCH 01/11] Log error when podman client cannot be initialized Signed-off-by: Parthvi Vala --- pkg/odo/genericclioptions/clientset/clientset.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/odo/genericclioptions/clientset/clientset.go b/pkg/odo/genericclioptions/clientset/clientset.go index 1e0e1242d6b..648dc361891 100644 --- a/pkg/odo/genericclioptions/clientset/clientset.go +++ b/pkg/odo/genericclioptions/clientset/clientset.go @@ -13,10 +13,12 @@ package clientset import ( "github.com/spf13/cobra" + "k8s.io/klog" "github.com/redhat-developer/odo/pkg/dev/kubedev" "github.com/redhat-developer/odo/pkg/dev/podmandev" "github.com/redhat-developer/odo/pkg/exec" + "github.com/redhat-developer/odo/pkg/log" "github.com/redhat-developer/odo/pkg/logs" "github.com/redhat-developer/odo/pkg/odo/commonflags" "github.com/redhat-developer/odo/pkg/podman" @@ -169,6 +171,9 @@ func Fetch(command *cobra.Command, platform string) (*Clientset, error) { if isDefined(command, PODMAN) || isDefined(command, PODMAN_NULLABLE) { dep.PodmanClient, err = podman.NewPodmanCli(ctx) if err != nil { + if !log.IsJSON() { + klog.V(2).Infof("Failed to initate the podman client: %s", err) + } if isDefined(command, PODMAN) { return nil, err } From 523f7289cd70f6e9aa6a0fc3ce99c35e09f646fe Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Thu, 26 Jan 2023 14:15:54 +0530 Subject: [PATCH 02/11] Return error if platform is podman Signed-off-by: Parthvi Vala --- pkg/odo/genericclioptions/clientset/clientset.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/odo/genericclioptions/clientset/clientset.go b/pkg/odo/genericclioptions/clientset/clientset.go index 648dc361891..47dbd2c19f4 100644 --- a/pkg/odo/genericclioptions/clientset/clientset.go +++ b/pkg/odo/genericclioptions/clientset/clientset.go @@ -12,13 +12,13 @@ package clientset import ( + "fmt" + "github.com/spf13/cobra" - "k8s.io/klog" "github.com/redhat-developer/odo/pkg/dev/kubedev" "github.com/redhat-developer/odo/pkg/dev/podmandev" "github.com/redhat-developer/odo/pkg/exec" - "github.com/redhat-developer/odo/pkg/log" "github.com/redhat-developer/odo/pkg/logs" "github.com/redhat-developer/odo/pkg/odo/commonflags" "github.com/redhat-developer/odo/pkg/podman" @@ -171,11 +171,9 @@ func Fetch(command *cobra.Command, platform string) (*Clientset, error) { if isDefined(command, PODMAN) || isDefined(command, PODMAN_NULLABLE) { dep.PodmanClient, err = podman.NewPodmanCli(ctx) if err != nil { - if !log.IsJSON() { - klog.V(2).Infof("Failed to initate the podman client: %s", err) - } - if isDefined(command, PODMAN) { - return nil, err + // send error in case the command is to run on podman platform or if PODMAN clientset is required. + if isDefined(command, PODMAN) || platform == commonflags.PlatformPodman { + return nil, fmt.Errorf("failed to initialize podman client: %s", err) } dep.PodmanClient = nil } From d76ba48abd188c59a2a1a1f1b567ac2d33bead0e Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Tue, 31 Jan 2023 11:53:36 +0530 Subject: [PATCH 03/11] Refactor errors related to cluster/podman inaccessible Signed-off-by: Parthvi Vala --- pkg/binding/binding.go | 4 ++-- pkg/kclient/errors.go | 11 ++++++++++ pkg/odo/cli/describe/component.go | 20 +++++++++---------- pkg/odo/cli/dev/dev.go | 7 ++++--- pkg/odo/cli/list/component/list.go | 6 +++--- .../genericclioptions/clientset/clientset.go | 4 +--- pkg/podman/errors.go | 17 ++++++++++++++++ tests/integration/cmd_dev_test.go | 7 +++++++ 8 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 pkg/podman/errors.go diff --git a/pkg/binding/binding.go b/pkg/binding/binding.go index 7a91453f6ee..f721a9ef019 100644 --- a/pkg/binding/binding.go +++ b/pkg/binding/binding.go @@ -154,7 +154,7 @@ func (o *BindingClient) GetBindingsFromDevfile(devfileObj parser.DevfileObj, con } sb.Status, err = o.getStatusFromBinding(sb.Name) if err != nil { - warning = clierrors.NewWarning("unable to access the cluster", err) + warning = clierrors.NewWarning(kclient.NewNoConnectionError().Error(), err) } result = append(result, sb) @@ -170,7 +170,7 @@ func (o *BindingClient) GetBindingsFromDevfile(devfileObj parser.DevfileObj, con sb := kclient.APIServiceBindingFromSpec(sbc) sb.Status, err = o.getStatusFromSpec(sb.Name) if err != nil { - warning = clierrors.NewWarning("unable to access the cluster", err) + warning = clierrors.NewWarning(kclient.NewNoConnectionError().Error(), err) } result = append(result, sb) diff --git a/pkg/kclient/errors.go b/pkg/kclient/errors.go index 2f6e42d9584..e69fa1f91a4 100644 --- a/pkg/kclient/errors.go +++ b/pkg/kclient/errors.go @@ -19,3 +19,14 @@ type ServiceNotFoundError struct { func (e *ServiceNotFoundError) Error() string { return fmt.Sprintf("service not found for the selector %q", e.Selector) } + +type NoConnectionError struct{} + +func NewNoConnectionError() NoConnectionError { + return NoConnectionError{} +} + +func (e NoConnectionError) Error() string { + // could also be "cluster is non accessible" + return fmt.Sprintf("unable to access the cluster") +} diff --git a/pkg/odo/cli/describe/component.go b/pkg/odo/cli/describe/component.go index 223fee17be2..86be92ef7af 100644 --- a/pkg/odo/cli/describe/component.go +++ b/pkg/odo/cli/describe/component.go @@ -93,7 +93,7 @@ func (o *ComponentOptions) Validate(ctx context.Context) (err error) { switch fcontext.GetPlatform(ctx, commonflags.PlatformCluster) { case commonflags.PlatformCluster: if o.clientset.KubernetesClient == nil { - log.Warning("No connection to cluster defined") + log.Warning(kclient.NewNoConnectionError()) } case commonflags.PlatformPodman: if o.namespaceFlag != "" { @@ -147,25 +147,25 @@ func (o *ComponentOptions) describeNamedComponent(ctx context.Context, name stri if isPlatformFeatureEnabled { //Get info from all platforms if kubeClient == nil { - log.Warning("cluster is non accessible") + log.Warning(kclient.NewNoConnectionError()) } if podmanClient == nil { - log.Warning("unable to access podman. Do you have podman client installed?") + log.Warning(podman.NewPodmanNotFoundError(nil)) } } else { if kubeClient == nil { - return api.Component{}, nil, errors.New("cluster is non accessible") + return api.Component{}, nil, kclient.NewNoConnectionError() } podmanClient = nil } case commonflags.PlatformCluster: if kubeClient == nil { - return api.Component{}, nil, errors.New("cluster is non accessible") + return api.Component{}, nil, kclient.NewNoConnectionError() } podmanClient = nil case commonflags.PlatformPodman: if podmanClient == nil { - return api.Component{}, nil, errors.New("unable to access podman. Do you have podman client installed?") + return api.Component{}, nil, podman.NewPodmanNotFoundError(nil) } kubeClient = nil } @@ -224,19 +224,19 @@ func (o *ComponentOptions) describeDevfileComponent(ctx context.Context) (result switch platform { case "": if kubeClient == nil { - log.Warning("cluster is non accessible") + log.Warning(kclient.NewNoConnectionError()) } if isPlatformFeatureEnabled && podmanClient == nil { - log.Warning("unable to access podman. Do you have podman client installed?") + log.Warning(podman.NewPodmanNotFoundError(nil)) } case commonflags.PlatformCluster: if kubeClient == nil { - return api.Component{}, nil, errors.New("cluster is non accessible") + return api.Component{}, nil, kclient.NewNoConnectionError() } podmanClient = nil case commonflags.PlatformPodman: if podmanClient == nil { - return api.Component{}, nil, errors.New("unable to access podman. Do you have podman client installed?") + return api.Component{}, nil, podman.NewPodmanNotFoundError(nil) } kubeClient = nil } diff --git a/pkg/odo/cli/dev/dev.go b/pkg/odo/cli/dev/dev.go index 884b45c9e6c..99dd63a8509 100644 --- a/pkg/odo/cli/dev/dev.go +++ b/pkg/odo/cli/dev/dev.go @@ -2,7 +2,6 @@ package dev import ( "context" - "errors" "fmt" "io" "path/filepath" @@ -12,6 +11,7 @@ import ( "github.com/redhat-developer/odo/pkg/component" "github.com/redhat-developer/odo/pkg/dev" + "github.com/redhat-developer/odo/pkg/kclient" "github.com/redhat-developer/odo/pkg/libdevfile" "github.com/redhat-developer/odo/pkg/log" clierrors "github.com/redhat-developer/odo/pkg/odo/cli/errors" @@ -23,6 +23,7 @@ import ( "github.com/redhat-developer/odo/pkg/odo/genericclioptions" "github.com/redhat-developer/odo/pkg/odo/genericclioptions/clientset" odoutil "github.com/redhat-developer/odo/pkg/odo/util" + "github.com/redhat-developer/odo/pkg/podman" scontext "github.com/redhat-developer/odo/pkg/segment/context" "github.com/redhat-developer/odo/pkg/util" "github.com/redhat-developer/odo/pkg/version" @@ -105,12 +106,12 @@ func (o *DevOptions) Validate(ctx context.Context) error { switch platform { case commonflags.PlatformCluster: if o.clientset.KubernetesClient == nil { - return errors.New("no connection to cluster defined") + return kclient.NewNoConnectionError() } scontext.SetPlatform(ctx, o.clientset.KubernetesClient) case commonflags.PlatformPodman: if o.clientset.PodmanClient == nil { - return errors.New("unable to access podman. Do you have podman client installed?") + return podman.NewPodmanNotFoundError(nil) } scontext.SetPlatform(ctx, o.clientset.PodmanClient) } diff --git a/pkg/odo/cli/list/component/list.go b/pkg/odo/cli/list/component/list.go index 161c7452f40..f123621d769 100644 --- a/pkg/odo/cli/list/component/list.go +++ b/pkg/odo/cli/list/component/list.go @@ -2,7 +2,6 @@ package component import ( "context" - "errors" "fmt" "github.com/jedib0t/go-pretty/v6/table" @@ -10,6 +9,7 @@ import ( "github.com/spf13/cobra" "github.com/redhat-developer/odo/pkg/api" + "github.com/redhat-developer/odo/pkg/kclient" "github.com/redhat-developer/odo/pkg/odo/cli/feature" "github.com/redhat-developer/odo/pkg/odo/cli/ui" "github.com/redhat-developer/odo/pkg/odo/commonflags" @@ -64,7 +64,7 @@ func (lo *ListOptions) Complete(ctx context.Context, cmdline cmdline.Cmdline, ar // if it hasn't, we will search from the default project / namespace. if lo.namespaceFlag != "" { if lo.clientset.KubernetesClient == nil { - return errors.New("cluster is non accessible") + return kclient.NewNoConnectionError() } lo.namespaceFilter = lo.namespaceFlag } else if lo.clientset.KubernetesClient != nil { @@ -77,7 +77,7 @@ func (lo *ListOptions) Complete(ctx context.Context, cmdline cmdline.Cmdline, ar // Validate ... func (lo *ListOptions) Validate(ctx context.Context) (err error) { if lo.clientset.KubernetesClient == nil { - log.Warning("No connection to cluster defined") + log.Warning(kclient.NewNoConnectionError()) } return nil } diff --git a/pkg/odo/genericclioptions/clientset/clientset.go b/pkg/odo/genericclioptions/clientset/clientset.go index 47dbd2c19f4..f1d44e0cc95 100644 --- a/pkg/odo/genericclioptions/clientset/clientset.go +++ b/pkg/odo/genericclioptions/clientset/clientset.go @@ -12,8 +12,6 @@ package clientset import ( - "fmt" - "github.com/spf13/cobra" "github.com/redhat-developer/odo/pkg/dev/kubedev" @@ -173,7 +171,7 @@ func Fetch(command *cobra.Command, platform string) (*Clientset, error) { if err != nil { // send error in case the command is to run on podman platform or if PODMAN clientset is required. if isDefined(command, PODMAN) || platform == commonflags.PlatformPodman { - return nil, fmt.Errorf("failed to initialize podman client: %s", err) + return nil, podman.NewPodmanNotFoundError(err) } dep.PodmanClient = nil } diff --git a/pkg/podman/errors.go b/pkg/podman/errors.go new file mode 100644 index 00000000000..28ab8cabb3e --- /dev/null +++ b/pkg/podman/errors.go @@ -0,0 +1,17 @@ +package podman + +import ( + "fmt" +) + +type PodmanNotFoundError struct { + err error +} + +func NewPodmanNotFoundError(err error) PodmanNotFoundError { + return PodmanNotFoundError{err: err} +} + +func (o PodmanNotFoundError) Error() string { + return fmt.Errorf("unable to access podman. Do you have podman client installed?; Cause: %w", o.err).Error() +} diff --git a/tests/integration/cmd_dev_test.go b/tests/integration/cmd_dev_test.go index 6705c1a2a95..820789e2d79 100644 --- a/tests/integration/cmd_dev_test.go +++ b/tests/integration/cmd_dev_test.go @@ -3290,6 +3290,13 @@ CMD ["npm", "start"] } + Context("odo dev on podman bound to fail", Label(helper.LabelPodman), func() { + BeforeEach(func() { + helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), + filepath.Join(commonVar.Context, "devfile.yaml"), + helper.DevfileMetadataNameSetter(cmpName)) + }) + }) Context("odo dev on podman with a devfile bound to fail", Label(helper.LabelPodman), func() { BeforeEach(func() { helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context) From 650513ab428f35d3c383a4ec0baaeebd8fcfbe2c Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Tue, 31 Jan 2023 11:58:24 +0530 Subject: [PATCH 04/11] Fix integration test Signed-off-by: Parthvi Vala --- pkg/podman/errors.go | 2 +- tests/integration/cmd_describe_component_test.go | 4 ++-- tests/integration/cmd_dev_test.go | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/podman/errors.go b/pkg/podman/errors.go index 28ab8cabb3e..3646536c622 100644 --- a/pkg/podman/errors.go +++ b/pkg/podman/errors.go @@ -13,5 +13,5 @@ func NewPodmanNotFoundError(err error) PodmanNotFoundError { } func (o PodmanNotFoundError) Error() string { - return fmt.Errorf("unable to access podman. Do you have podman client installed?; Cause: %w", o.err).Error() + return fmt.Errorf("unable to access podman. Do you have podman client installed? Cause: %w", o.err).Error() } diff --git a/tests/integration/cmd_describe_component_test.go b/tests/integration/cmd_describe_component_test.go index ce97a1f7f1f..16f8822f0e6 100644 --- a/tests/integration/cmd_describe_component_test.go +++ b/tests/integration/cmd_describe_component_test.go @@ -350,7 +350,7 @@ var _ = Describe("odo describe component command tests", func() { // Podman mode assumes the test does not require a cluster. // But running "odo describe component --name" in non-experimental mode attempts to get information from a cluster first. // TODO We need to think about how to test both Cluster and Podman modes. - Expect(stderr).To(ContainSubstring("cluster is non accessible")) + Expect(stderr).To(ContainSubstring("no connection to cluster defined")) Expect(stdout).NotTo(ContainSubstring("Forwarded ports")) Expect(stdout).NotTo(ContainSubstring("Running on")) Expect(stdout).NotTo(ContainSubstring("podman:")) @@ -522,7 +522,7 @@ var _ = Describe("odo describe component command tests", func() { Expect(stdout).To(BeEmpty()) helper.JsonPathDoesNotExist(stderr, "runningOn") // Deprecated helper.JsonPathDoesNotExist(stderr, "platform") - helper.JsonPathContentIs(stderr, "message", "cluster is non accessible") + helper.JsonPathContentIs(stderr, "message", "no connection to cluster defined") helper.JsonPathDoesNotExist(stderr, "devfilePath") helper.JsonPathDoesNotExist(stderr, "devForwardedPorts") helper.JsonPathDoesNotExist(stderr, "devfileData") diff --git a/tests/integration/cmd_dev_test.go b/tests/integration/cmd_dev_test.go index 820789e2d79..533e3de5296 100644 --- a/tests/integration/cmd_dev_test.go +++ b/tests/integration/cmd_dev_test.go @@ -3290,12 +3290,16 @@ CMD ["npm", "start"] } - Context("odo dev on podman bound to fail", Label(helper.LabelPodman), func() { + Context("odo dev on podman when podman in unavailable", Label(helper.LabelPodman), func() { BeforeEach(func() { helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(commonVar.Context, "devfile.yaml"), helper.DevfileMetadataNameSetter(cmpName)) }) + It("should fail to run odo dev", func() { + errOut := helper.Cmd("odo", "dev", "--platform", "podman").WithEnv("PODMAN_CMD=echo").ShouldFail().Err() + Expect(errOut).To(ContainSubstring("unable to access podman. Do you have podman client installed? Cause: executable \"echo\" not found")) + }) }) Context("odo dev on podman with a devfile bound to fail", Label(helper.LabelPodman), func() { BeforeEach(func() { From d4998f61acea8d5634d45725e0c405819fbc6946 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Tue, 31 Jan 2023 14:29:15 +0530 Subject: [PATCH 05/11] fix validation failure --- pkg/kclient/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kclient/errors.go b/pkg/kclient/errors.go index e69fa1f91a4..d8d2417f7c5 100644 --- a/pkg/kclient/errors.go +++ b/pkg/kclient/errors.go @@ -28,5 +28,5 @@ func NewNoConnectionError() NoConnectionError { func (e NoConnectionError) Error() string { // could also be "cluster is non accessible" - return fmt.Sprintf("unable to access the cluster") + return "unable to access the cluster" } From c1ee11777e81e34e8bc7ae91b66bca4074655a57 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Wed, 1 Feb 2023 12:33:18 +0530 Subject: [PATCH 06/11] rm3l's review --- pkg/podman/errors.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/podman/errors.go b/pkg/podman/errors.go index 3646536c622..e31cc0ab17a 100644 --- a/pkg/podman/errors.go +++ b/pkg/podman/errors.go @@ -13,5 +13,9 @@ func NewPodmanNotFoundError(err error) PodmanNotFoundError { } func (o PodmanNotFoundError) Error() string { - return fmt.Errorf("unable to access podman. Do you have podman client installed? Cause: %w", o.err).Error() + msg := "unable to access podman. Do you have podman client installed?" + if o.err == nil { + return msg + } + return fmt.Errorf("%s Cause: %w", msg, o.err).Error() } From 0b30499928925b8183f134b8b5d110c0389bddc9 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Wed, 1 Feb 2023 12:33:54 +0530 Subject: [PATCH 07/11] Attempt at fixing CI failures Signed-off-by: Parthvi Vala --- tests/integration/cmd_describe_component_test.go | 4 ++-- tests/integration/cmd_dev_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/cmd_describe_component_test.go b/tests/integration/cmd_describe_component_test.go index 16f8822f0e6..16b56d8c099 100644 --- a/tests/integration/cmd_describe_component_test.go +++ b/tests/integration/cmd_describe_component_test.go @@ -350,7 +350,7 @@ var _ = Describe("odo describe component command tests", func() { // Podman mode assumes the test does not require a cluster. // But running "odo describe component --name" in non-experimental mode attempts to get information from a cluster first. // TODO We need to think about how to test both Cluster and Podman modes. - Expect(stderr).To(ContainSubstring("no connection to cluster defined")) + Expect(stderr).To(ContainSubstring("unable to access the cluster")) Expect(stdout).NotTo(ContainSubstring("Forwarded ports")) Expect(stdout).NotTo(ContainSubstring("Running on")) Expect(stdout).NotTo(ContainSubstring("podman:")) @@ -522,7 +522,7 @@ var _ = Describe("odo describe component command tests", func() { Expect(stdout).To(BeEmpty()) helper.JsonPathDoesNotExist(stderr, "runningOn") // Deprecated helper.JsonPathDoesNotExist(stderr, "platform") - helper.JsonPathContentIs(stderr, "message", "no connection to cluster defined") + helper.JsonPathContentIs(stderr, "message", "unable to access the cluster") helper.JsonPathDoesNotExist(stderr, "devfilePath") helper.JsonPathDoesNotExist(stderr, "devForwardedPorts") helper.JsonPathDoesNotExist(stderr, "devfileData") diff --git a/tests/integration/cmd_dev_test.go b/tests/integration/cmd_dev_test.go index 533e3de5296..96dc6dcd86a 100644 --- a/tests/integration/cmd_dev_test.go +++ b/tests/integration/cmd_dev_test.go @@ -3297,7 +3297,7 @@ CMD ["npm", "start"] helper.DevfileMetadataNameSetter(cmpName)) }) It("should fail to run odo dev", func() { - errOut := helper.Cmd("odo", "dev", "--platform", "podman").WithEnv("PODMAN_CMD=echo").ShouldFail().Err() + errOut := helper.Cmd("odo", "dev", "--platform", "podman").WithEnv("PODMAN_CMD=echo", "ODO_EXPERIMENTAL_MODE=true").ShouldFail().Err() Expect(errOut).To(ContainSubstring("unable to access podman. Do you have podman client installed? Cause: executable \"echo\" not found")) }) }) From 4d057f7b6ab30f3ee66751d48ea949110e89920d Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Wed, 1 Feb 2023 14:45:12 +0530 Subject: [PATCH 08/11] Log error when unable to find podman client in NewPodmanCli Signed-off-by: Parthvi Vala --- pkg/podman/errors.go | 2 +- pkg/podman/podman.go | 2 +- tests/integration/cmd_dev_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/podman/errors.go b/pkg/podman/errors.go index e31cc0ab17a..5634a5624d5 100644 --- a/pkg/podman/errors.go +++ b/pkg/podman/errors.go @@ -17,5 +17,5 @@ func (o PodmanNotFoundError) Error() string { if o.err == nil { return msg } - return fmt.Errorf("%s Cause: %w", msg, o.err).Error() + return fmt.Errorf("%s cause: %w", msg, o.err).Error() } diff --git a/pkg/podman/podman.go b/pkg/podman/podman.go index 754a22c8a6c..f4563576d22 100644 --- a/pkg/podman/podman.go +++ b/pkg/podman/podman.go @@ -27,7 +27,7 @@ func NewPodmanCli(ctx context.Context) (*PodmanCli, error) { } version, err := cli.Version() if err != nil { - return nil, fmt.Errorf("executable %q not found", cli.podmanCmd) + return nil, fmt.Errorf("executable %q not found; cause: %w", cli.podmanCmd, err) } if version.Client == nil { return nil, fmt.Errorf("executable %q not recognized as podman client", cli.podmanCmd) diff --git a/tests/integration/cmd_dev_test.go b/tests/integration/cmd_dev_test.go index 96dc6dcd86a..e603fcf6adc 100644 --- a/tests/integration/cmd_dev_test.go +++ b/tests/integration/cmd_dev_test.go @@ -3298,7 +3298,7 @@ CMD ["npm", "start"] }) It("should fail to run odo dev", func() { errOut := helper.Cmd("odo", "dev", "--platform", "podman").WithEnv("PODMAN_CMD=echo", "ODO_EXPERIMENTAL_MODE=true").ShouldFail().Err() - Expect(errOut).To(ContainSubstring("unable to access podman. Do you have podman client installed? Cause: executable \"echo\" not found")) + Expect(errOut).To(ContainSubstring("unable to access podman. Do you have podman client installed? cause: executable \"echo\" not found")) }) }) Context("odo dev on podman with a devfile bound to fail", Label(helper.LabelPodman), func() { From cff630c5cc4e963dc061fe0c8f27f1ac46b23584 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Fri, 3 Feb 2023 10:37:00 +0530 Subject: [PATCH 09/11] Update pkg/podman/podman.go Co-authored-by: Armel Soro --- pkg/podman/podman.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/podman/podman.go b/pkg/podman/podman.go index f4563576d22..75d48e6930c 100644 --- a/pkg/podman/podman.go +++ b/pkg/podman/podman.go @@ -27,7 +27,7 @@ func NewPodmanCli(ctx context.Context) (*PodmanCli, error) { } version, err := cli.Version() if err != nil { - return nil, fmt.Errorf("executable %q not found; cause: %w", cli.podmanCmd, err) + return nil, err } if version.Client == nil { return nil, fmt.Errorf("executable %q not recognized as podman client", cli.podmanCmd) From 5d246ff3d476a260057dfbc43b54390b913463f1 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Fri, 3 Feb 2023 10:37:11 +0530 Subject: [PATCH 10/11] Update pkg/podman/errors.go Co-authored-by: Armel Soro --- pkg/podman/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/podman/errors.go b/pkg/podman/errors.go index 5634a5624d5..ea37f7ed5d9 100644 --- a/pkg/podman/errors.go +++ b/pkg/podman/errors.go @@ -13,7 +13,7 @@ func NewPodmanNotFoundError(err error) PodmanNotFoundError { } func (o PodmanNotFoundError) Error() string { - msg := "unable to access podman. Do you have podman client installed?" + msg := "unable to access podman. Do you have podman client installed and configured correctly?" if o.err == nil { return msg } From 3b22e20e6b3426ddee9af2f0c9d7f7c19136e343 Mon Sep 17 00:00:00 2001 From: Parthvi Vala Date: Fri, 3 Feb 2023 11:11:03 +0530 Subject: [PATCH 11/11] Fix integration test Signed-off-by: Parthvi Vala --- tests/integration/cmd_dev_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cmd_dev_test.go b/tests/integration/cmd_dev_test.go index e603fcf6adc..d80ed67a7d5 100644 --- a/tests/integration/cmd_dev_test.go +++ b/tests/integration/cmd_dev_test.go @@ -3298,7 +3298,7 @@ CMD ["npm", "start"] }) It("should fail to run odo dev", func() { errOut := helper.Cmd("odo", "dev", "--platform", "podman").WithEnv("PODMAN_CMD=echo", "ODO_EXPERIMENTAL_MODE=true").ShouldFail().Err() - Expect(errOut).To(ContainSubstring("unable to access podman. Do you have podman client installed? cause: executable \"echo\" not found")) + Expect(errOut).To(ContainSubstring("unable to access podman. Do you have podman client installed and configured correctly? cause: exec: \"echo\": executable file not found in $PATH")) }) }) Context("odo dev on podman with a devfile bound to fail", Label(helper.LabelPodman), func() {