From ae82d18928eeff7021b36bf0477338d015695408 Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Fri, 20 Jan 2023 15:53:51 +0100 Subject: [PATCH] Make doc tests pass (#6516) * Fix docs * Display env vars in a sorted order * Run on quickstart-demo --- .../init/devfile_from_any_registry_output.mdx | 1 - .../devfile_from_specific_registry_output.mdx | 1 - .../docs-mdx/init/devfile_from_url_output.mdx | 1 - .../init/latest_versioned_devfile_output.mdx | 1 - .../docs-mdx/init/registry_list_output.mdx | 1 - .../docs-mdx/init/registry_output.mdx | 1 - .../init/versioned_devfile_output.mdx | 1 - .../docs-mdx/create_namespace_output.mdx | 1 - .../docs-mdx/create_project_output.mdx | 1 - .../docs-mdx/dotnet/dotnet_odo_dev_output.mdx | 5 +- .../dotnet/dotnet_odo_init_output.mdx | 4 +- .../docs-mdx/go/go_odo_dev_output.mdx | 5 +- .../docs-mdx/java/java_odo_dev_output.mdx | 7 +- .../docs-mdx/java/java_odo_init_output.mdx | 9 +-- .../docs-mdx/nodejs/nodejs_odo_dev_output.mdx | 7 +- pkg/init/backend/interactive.go | 9 ++- .../doc_command_reference_init_test.go | 50 ++++++++------ .../doc_user_guides_quickstart_test.go | 69 ++++++++++--------- 18 files changed, 85 insertions(+), 89 deletions(-) diff --git a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx index 25316bbc98d..646ac26babd 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_any_registry_output.mdx @@ -11,5 +11,4 @@ $ odo init --devfile nodejs-react --name my-nr-app Your new component 'my-nr-app' is ready in the current directory. To start editing your component, use 'odo dev' and open this folder in your favorite IDE. Changes will be directly reflected on the cluster. - ``` diff --git a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx index 8748b043efd..7eb34cb7979 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_specific_registry_output.mdx @@ -12,5 +12,4 @@ $ odo init --name my-spring-app --devfile java-springboot --devfile-registry Def Your new component 'my-spring-app' is ready in the current directory. To start editing your component, use 'odo dev' and open this folder in your favorite IDE. Changes will be directly reflected on the cluster. - ``` \ No newline at end of file diff --git a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx index f90655ffdd7..024ae5811d8 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/devfile_from_url_output.mdx @@ -12,5 +12,4 @@ $ odo init --devfile-path https://registry.devfile.io/devfiles/nodejs-angular -- Your new component 'my-nodejs-app' is ready in the current directory. To start editing your component, use 'odo dev' and open this folder in your favorite IDE. Changes will be directly reflected on the cluster. - ``` \ No newline at end of file diff --git a/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx index d43d0f2d584..6e152ede689 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/latest_versioned_devfile_output.mdx @@ -12,5 +12,4 @@ Your new component 'my-go-app' is ready in the current directory. To start editing your component, use 'odo dev' and open this folder in your favorite IDE. Changes will be directly reflected on the cluster. To deploy your component to a cluster use "odo deploy". - ``` \ No newline at end of file diff --git a/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx index 75050b72dce..00ada0c0446 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx @@ -3,5 +3,4 @@ $ odo registry --devfile nodejs-react NAME REGISTRY DESCRIPTION VERSIONS nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2 nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2 - ``` \ No newline at end of file diff --git a/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx index e8a78eddeb1..81039500161 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/registry_output.mdx @@ -6,5 +6,4 @@ Devfile registries: NAME URL SECURE StagingRegistry https://registry.stage.devfile.io No DefaultDevfileRegistry https://registry.devfile.io No - ``` \ No newline at end of file diff --git a/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx index 7a0c21da5e9..24ebc73ddb0 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/versioned_devfile_output.mdx @@ -12,5 +12,4 @@ Your new component 'my-go-app' is ready in the current directory. To start editing your component, use 'odo dev' and open this folder in your favorite IDE. Changes will be directly reflected on the cluster. To deploy your component to a cluster use "odo deploy". - ``` diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/create_namespace_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/create_namespace_output.mdx index f4e95767d5a..5534c628825 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/create_namespace_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/create_namespace_output.mdx @@ -2,5 +2,4 @@ $ odo create namespace odo-dev ✓ Namespace "odo-dev" is ready for use ✓ New namespace created and now using namespace: odo-dev - ``` \ No newline at end of file diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/create_project_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/create_project_output.mdx index f162c9d3d54..941df0820db 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/create_project_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/create_project_output.mdx @@ -2,5 +2,4 @@ $ odo create project odo-dev ✓ Project "odo-dev" is ready for use ✓ New project created and now using project: odo-dev - ``` \ No newline at end of file diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx index 4d8ad1883b0..b7039ee0c16 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_dev_output.mdx @@ -11,17 +11,16 @@ $ odo dev ⚠ Pod is Pending ✓ Pod is Running ✓ Syncing files into the container [171ms] - ✓ Building your application in container on cluster (command: build) [7s] + ✓ Building your application in container (command: build) [7s] • Executing the application (command: run) ... - Forwarding from 127.0.0.1:40001 -> 8080 ↪ Dev mode Status: - Watching for changes in the current directory /home/user/quickstart-demo/dotnet-demo + Watching for changes in the current directory /home/user/quickstart-demo Keyboard Commands: [Ctrl+c] - Exit and delete resources from the cluster [p] - Manually apply local changes to the application on the cluster - ``` \ No newline at end of file diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx index 90f538ad2ce..bfa697c1b33 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/dotnet/dotnet_odo_init_output.mdx @@ -20,10 +20,10 @@ The devfile "dotnet50:1.0.3" from the registry "DefaultDevfileRegistry" will be OPEN PORTS: - 8080 ENVIRONMENT VARIABLES: - - CONFIGURATION = Debug - - STARTUP_PROJECT = app.csproj - ASPNETCORE_ENVIRONMENT = Development - ASPNETCORE_URLS = http://*:8080 + - CONFIGURATION = Debug + - STARTUP_PROJECT = app.csproj ? Select container for which you want to change configuration? NONE - configuration is correct ? Enter component name: my-dotnet-app diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx index 47948217e61..0c9bfd32029 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/go/go_odo_dev_output.mdx @@ -11,17 +11,16 @@ $ odo dev ⚠ Pod is Pending ✓ Pod is Running ✓ Syncing files into the container [113ms] - ✓ Building your application in container on cluster (command: build) [422ms] + ✓ Building your application in container (command: build) [422ms] • Executing the application (command: run) ... - Forwarding from 127.0.0.1:40001 -> 8080 ↪ Dev mode Status: - Watching for changes in the current directory /home/user/quickstart-demo/go-demo + Watching for changes in the current directory /home/user/quickstart-demo Keyboard Commands: [Ctrl+c] - Exit and delete resources from the cluster [p] - Manually apply local changes to the application on the cluster - ``` \ No newline at end of file diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx index 2a0eef4da8d..25a627731c1 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_dev_output.mdx @@ -12,19 +12,16 @@ $ odo dev ⚠ Pod is Pending ✓ Pod is Running ✓ Syncing files into the container [167ms] - ✓ Building your application in container on cluster (command: build) [3m] + ✓ Building your application in container (command: build) [3m] • Executing the application (command: run) ... - Forwarding from 127.0.0.1:40001 -> 8080 - - Forwarding from 127.0.0.1:40002 -> 5858 - ↪ Dev mode Status: - Watching for changes in the current directory /home/user/quickstart-demo/java-demo + Watching for changes in the current directory /home/user/quickstart-demo Keyboard Commands: [Ctrl+c] - Exit and delete resources from the cluster [p] - Manually apply local changes to the application on the cluster - ``` \ No newline at end of file diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx index e31e6a8c07a..66dc366e5ee 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/java/java_odo_init_output.mdx @@ -9,12 +9,9 @@ $ odo init Interactive mode enabled, please answer the following questions: Based on the files in the current directory odo detected Language: Java -Project type: Maven -The devfile "java-maven:1.2.0" from the registry "DefaultDevfileRegistry" will be downloaded. -? Is this correct? No -? Select language: Java -? Select project type: Spring Boot -? Select version: 1.2.0 (default) +Project type: springboot +The devfile "java-springboot:1.2.0" from the registry "DefaultDevfileRegistry" will be downloaded. +? Is this correct? Yes ✓ Downloading devfile "java-springboot:1.2.0" from registry "DefaultDevfileRegistry" [3s] ↪ Container Configuration "tools": diff --git a/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx b/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx index 35c91333b95..268f20aaeab 100644 --- a/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx +++ b/docs/website/docs/user-guides/quickstart/docs-mdx/nodejs/nodejs_odo_dev_output.mdx @@ -11,19 +11,16 @@ $ odo dev ⚠ Pod is Pending ✓ Pod is Running ✓ Syncing files into the container [193ms] - ✓ Building your application in container on cluster (command: install) [5s] + ✓ Building your application in container (command: install) [5s] • Executing the application (command: run) ... - Forwarding from 127.0.0.1:40001 -> 3000 - - Forwarding from 127.0.0.1:40002 -> 5858 - ↪ Dev mode Status: - Watching for changes in the current directory /home/user/quickstart-demo/nodejs-demo + Watching for changes in the current directory /home/user/quickstart-demo Keyboard Commands: [Ctrl+c] - Exit and delete resources from the cluster [p] - Manually apply local changes to the application on the cluster - ``` \ No newline at end of file diff --git a/pkg/init/backend/interactive.go b/pkg/init/backend/interactive.go index 1b1dc4a909e..d7c0f3971a7 100644 --- a/pkg/init/backend/interactive.go +++ b/pkg/init/backend/interactive.go @@ -303,8 +303,13 @@ func PrintConfiguration(config asker.DevfileConfiguration) { fmt.Fprintf(stdout, " ENVIRONMENT VARIABLES:\n") - for key, value := range container.Envs { - fmt.Fprintf(stdout, " - %s = %s\n", key, value) + keys := make([]string, 0, len(container.Envs)) + for key := range container.Envs { + keys = append(keys, key) + } + sort.Strings(keys) + for _, key := range keys { + fmt.Fprintf(stdout, " - %s = %s\n", key, container.Envs[key]) } } diff --git a/tests/documentation/command-reference/doc_command_reference_init_test.go b/tests/documentation/command-reference/doc_command_reference_init_test.go index 443a98db350..227f1daf110 100644 --- a/tests/documentation/command-reference/doc_command_reference_init_test.go +++ b/tests/documentation/command-reference/doc_command_reference_init_test.go @@ -53,9 +53,10 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), got := helper.StripAnsi(out) got = helper.StripInteractiveQuestion(got) got = fmt.Sprintf(outputStringFormat, args[1], helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonPath, "interactive_mode_empty_directory_output.mdx")) + file := "interactive_mode_empty_directory_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) When("the directory is not empty", func() { @@ -83,9 +84,10 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), got := helper.StripAnsi(out) got = helper.StripInteractiveQuestion(got) got = fmt.Sprintf(outputStringFormat, args[1], helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonPath, "interactive_mode_directory_with_sources_output.mdx")) + file := "interactive_mode_directory_with_sources_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) }) @@ -95,27 +97,30 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), args := []string{"init", "--devfile", "go", "--name", "my-go-app", "--devfile-version", "2.0.0"} out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) - want := helper.GetMDXContent(filepath.Join(commonPath, "versioned_devfile_output.mdx")) + file := "versioned_devfile_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) It("Fetch Devfile of the latest version", func() { args := []string{"init", "--devfile", "go", "--name", "my-go-app", "--devfile-version", "latest"} out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) - want := helper.GetMDXContent(filepath.Join(commonPath, "latest_versioned_devfile_output.mdx")) + file := "latest_versioned_devfile_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) It("Fetch Devfile from a URL", func() { args := []string{"init", "--devfile-path", "https://registry.devfile.io/devfiles/nodejs-angular", "--name", "my-nodejs-app", "--starter", "nodejs-angular-starter"} out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) - want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_url_output.mdx")) + file := "devfile_from_url_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) Context("fetching devfile from a registry", func() { @@ -147,9 +152,10 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), got := helper.StripAnsi(out) got = removePreferenceKeys(got) got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonPath, "registry_output.mdx")) + file := "registry_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) } It("Fetch Devfile from a specific registry of the list", func() { @@ -161,9 +167,10 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), args := []string{"init", "--name", "my-spring-app", "--devfile", "java-springboot", "--devfile-registry", "DefaultDevfileRegistry", "--starter", "springbootproject"} out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) - want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_specific_registry_output.mdx")) + file := "devfile_from_specific_registry_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) It("Fetch Devfile from any registry of the list", func() { @@ -176,18 +183,20 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), out := helper.Cmd("odo", args...).ShouldPass().Out() got := helper.StripAnsi(out) got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonPath, "registry_list_output.mdx")) + file := "registry_list_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) By("checking for the init output", func() { args := []string{"init", "--devfile", "nodejs-react", "--name", "my-nr-app"} out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) - want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_any_registry_output.mdx")) + file := "devfile_from_any_registry_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) @@ -198,9 +207,10 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster), args := []string{"init", "--devfile-path", "https://registry.devfile.io/devfiles/nodejs-angular", "--name", "my-nodejs-app", "--starter", "nodejs-angular-starter"} out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) - want := helper.GetMDXContent(filepath.Join(commonPath, "devfile_from_url_output.mdx")) + file := "devfile_from_url_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) diff --git a/tests/documentation/user-guides/doc_user_guides_quickstart_test.go b/tests/documentation/user-guides/doc_user_guides_quickstart_test.go index ee889d86e79..d95c706ba15 100644 --- a/tests/documentation/user-guides/doc_user_guides_quickstart_test.go +++ b/tests/documentation/user-guides/doc_user_guides_quickstart_test.go @@ -41,16 +41,18 @@ var _ = Describe("User guides: Quickstart test", func() { out := helper.Cmd("odo", args...).ShouldPass().Out() got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out)) By("checking the output for namespace", func() { - want := helper.GetMDXContent(filepath.Join(commonPath, "create_namespace_output.mdx")) + file := "create_namespace_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) By("checking the output for project", func() { got = strings.ReplaceAll(got, "namespace", "project") got = strings.ReplaceAll(got, "Namespace", "Project") - want := helper.GetMDXContent(filepath.Join(commonPath, "create_project_output.mdx")) + file := "create_project_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) }) @@ -81,9 +83,10 @@ var _ = Describe("User guides: Quickstart test", func() { got := helper.StripAnsi(out) got = helper.StripInteractiveQuestion(got) got = fmt.Sprintf(outputStringFormat, "init", helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonNodeJSPath, "nodejs_odo_init_output.mdx")) + file := "nodejs_odo_init_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonNodeJSPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) By("running odo dev", func() { session, out, _, cmdEndpointsMap, err := helper.StartDevMode(helper.DevSessionOpts{}) @@ -91,13 +94,14 @@ var _ = Describe("User guides: Quickstart test", func() { session.Stop() session.WaitEnd() args := []string{"dev"} - got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo/nodejs-demo") + got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo") got = helper.ReplaceAllForwardedPorts(got, cmdEndpointsMap, map[string]string{"3000": "127.0.0.1:40001", "5858": "127.0.0.1:40002"}) got = strings.ReplaceAll(got, commonVar.Project, namespace) got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonNodeJSPath, "nodejs_odo_dev_output.mdx")) + file := "nodejs_odo_dev_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonNodeJSPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) }) @@ -127,9 +131,10 @@ var _ = Describe("User guides: Quickstart test", func() { got := helper.StripAnsi(out) got = helper.StripInteractiveQuestion(got) got = fmt.Sprintf(outputStringFormat, "init", helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonGoPath, "go_odo_init_output.mdx")) + file := "go_odo_init_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonGoPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) By("running odo dev", func() { session, out, _, cmdEndpointsMap, err := helper.StartDevMode(helper.DevSessionOpts{}) @@ -137,13 +142,14 @@ var _ = Describe("User guides: Quickstart test", func() { session.Stop() session.WaitEnd() args := []string{"dev"} - got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo/go-demo") + got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo") got = helper.ReplaceAllForwardedPorts(got, cmdEndpointsMap, map[string]string{"8080": "127.0.0.1:40001"}) got = strings.ReplaceAll(got, commonVar.Project, namespace) got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonGoPath, "go_odo_dev_output.mdx")) + file := "go_odo_dev_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonGoPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) }) @@ -181,9 +187,10 @@ var _ = Describe("User guides: Quickstart test", func() { got = helper.StripInteractiveQuestion(got) got = strings.ReplaceAll(got, commonVar.Project, namespace) got = fmt.Sprintf(outputStringFormat, "init", helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commondotnetPath, "dotnet_odo_init_output.mdx")) + file := "dotnet_odo_init_output.mdx" + want := helper.GetMDXContent(filepath.Join(commondotnetPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) By("running odo dev", func() { session, out, _, cmdEndpointsMap, err := helper.StartDevMode(helper.DevSessionOpts{}) @@ -191,13 +198,14 @@ var _ = Describe("User guides: Quickstart test", func() { session.Stop() session.WaitEnd() args := []string{"dev"} - got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo/dotnet-demo") + got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo") got = helper.ReplaceAllForwardedPorts(got, cmdEndpointsMap, map[string]string{"8080": "127.0.0.1:40001"}) got = strings.ReplaceAll(got, commonVar.Project, namespace) got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commondotnetPath, "dotnet_odo_dev_output.mdx")) + file := "dotnet_odo_dev_output.mdx" + want := helper.GetMDXContent(filepath.Join(commondotnetPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) }) @@ -211,16 +219,7 @@ var _ = Describe("User guides: Quickstart test", func() { args := []string{"odo", "init"} out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) { helper.ExpectString(ctx, "Is this correct?") - helper.SendLine(ctx, "No") - - helper.ExpectString(ctx, "Select language") - helper.SendLine(ctx, "Java") - - helper.ExpectString(ctx, "Select project type") - helper.SendLine(ctx, "Spring") - - helper.ExpectString(ctx, "Select version") - helper.SendLine(ctx, "") + helper.SendLine(ctx, "Yes") helper.ExpectString(ctx, "✓ Downloading devfile \"java-springboot:1.2.0\" from registry \"DefaultDevfileRegistry\"") @@ -236,9 +235,10 @@ var _ = Describe("User guides: Quickstart test", func() { got := helper.StripAnsi(out) got = helper.StripInteractiveQuestion(got) got = fmt.Sprintf(outputStringFormat, "init", helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonGoPath, "java_odo_init_output.mdx")) + file := "java_odo_init_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonGoPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) By("running odo dev", func() { session, out, _, cmdEndpointsMap, err := helper.StartDevMode(helper.DevSessionOpts{TimeoutInSeconds: 420}) @@ -246,13 +246,14 @@ var _ = Describe("User guides: Quickstart test", func() { session.Stop() session.WaitEnd() args := []string{"dev"} - got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo/java-demo") + got := strings.ReplaceAll(string(out), commonVar.Context, "/home/user/quickstart-demo") got = helper.ReplaceAllForwardedPorts(got, cmdEndpointsMap, map[string]string{"8080": "127.0.0.1:40001", "5858": "127.0.0.1:40002"}) got = strings.ReplaceAll(got, commonVar.Project, namespace) got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got)) - want := helper.GetMDXContent(filepath.Join(commonGoPath, "java_odo_dev_output.mdx")) + file := "java_odo_dev_output.mdx" + want := helper.GetMDXContent(filepath.Join(commonGoPath, file)) diff := cmp.Diff(want, got) - Expect(diff).To(BeEmpty()) + Expect(diff).To(BeEmpty(), file) }) }) })