Use staging Devfile registry for PR tests (#7129)

* Revert using a DEVFILE_PROXY env var

There is no proxy deployed in the internal test cluster.
As such, this env var no longer makes sense.

* To help troubleshoot, display the resolved Devfile registry URL

* Make interactive tests more resilient with stack versions

They are now able to determine if the "Select version" prompt
should be asked by "odo init" or not:

* Make sure doc automation tests do not rely on hard-coded namespaces

* Allow to run doc automation tests with more parallel Ginkgo nodes

This is possible now that those tests no longer
depend on a single hard-coded namespace.

* Remove occurrences of the DEVFILE_REGISTRY env var in IBM Pipelines scripts

* Reuse logic for determining the Devfile Registry URL in "odo registry" tests

* Clarify what openshiftci-config.sh is used for
This commit is contained in:
Armel Soro
2023-10-27 09:54:14 +02:00
committed by GitHub
parent d77ca3e95a
commit 5d4a6ef325
23 changed files with 180 additions and 147 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/tests/helper"
)
@@ -15,11 +16,12 @@ var _ = Describe("doc command reference odo create namespace", func() {
var commonVar helper.CommonVar
var commonPath = filepath.Join("command-reference", "docs-mdx", "create-namespace")
var outputStringFormat = "```console\n$ odo %s\n%s```\n"
var ns string
BeforeEach(func() {
commonVar = helper.CommonBeforeEach()
helper.Chdir(commonVar.Context)
Expect(helper.VerifyFileExists(".odo/env/env.yaml")).To(BeFalse())
ns = helper.GenerateProjectName()
})
AfterEach(func() {
@@ -29,13 +31,16 @@ var _ = Describe("doc command reference odo create namespace", func() {
Context("To create a namespace resource", func() {
AfterEach(func() {
commonVar.CliRunner.DeleteNamespaceProject("odo-dev", true)
if commonVar.CliRunner.HasNamespaceProject(ns) {
commonVar.CliRunner.DeleteNamespaceProject(ns, false)
}
})
It("Creates a namespace resource for a kubernetes cluster", func() {
args := []string{"create", "namespace", "odo-dev"}
args := []string{"create", "namespace", ns}
out := helper.Cmd("odo", args...).ShouldPass().Out()
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
got = strings.ReplaceAll(got, ns, "odo-dev")
file := "create_namespace.mdx"
want := helper.GetMDXContent(filepath.Join(commonPath, file))
diff := cmp.Diff(want, got)
@@ -43,9 +48,10 @@ var _ = Describe("doc command reference odo create namespace", func() {
})
It("Creates a project resource for a kubernetes cluster", func() {
args := []string{"create", "project", "odo-dev"}
args := []string{"create", "project", ns}
out := helper.Cmd("odo", args...).ShouldPass().Out()
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
got = strings.ReplaceAll(got, ns, "odo-dev")
file := "create_project.mdx"
want := helper.GetMDXContent(filepath.Join(commonPath, file))
diff := cmp.Diff(want, got)

View File

@@ -3,6 +3,7 @@ package docautomation
import (
"fmt"
"path/filepath"
"strings"
"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2"
@@ -15,11 +16,12 @@ var _ = Describe("doc command reference odo delete namespace", func() {
var commonVar helper.CommonVar
var commonPath = filepath.Join("command-reference", "docs-mdx", "delete-namespace")
var outputStringFormat = "```console\n$ odo %s\n%s```\n"
var ns string
BeforeEach(func() {
commonVar = helper.CommonBeforeEach()
helper.Chdir(commonVar.Context)
Expect(helper.VerifyFileExists(".odo/env/env.yaml")).To(BeFalse())
ns = helper.GenerateProjectName()
})
AfterEach(func() {
@@ -29,18 +31,19 @@ var _ = Describe("doc command reference odo delete namespace", func() {
Context("To delete a namespace resource", func() {
BeforeEach(func() {
helper.Cmd("odo", "create", "namespace", "odo-dev").ShouldPass()
helper.Cmd("odo", "create", "namespace", ns).ShouldPass()
})
AfterEach(func() {
commonVar.CliRunner.DeleteNamespaceProject("odo-dev", true)
if commonVar.CliRunner.HasNamespaceProject(ns) {
commonVar.CliRunner.DeleteNamespaceProject(ns, false)
}
})
It("Deletes a namespace resource for a kubernetes cluster", func() {
args := []string{"odo", "delete", "namespace", "odo-dev"}
args := []string{"odo", "delete", "namespace", ns}
out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) {
helper.ExpectString(ctx, "? Are you sure you want to delete namespace \"odo-dev\"?")
helper.ExpectString(ctx, fmt.Sprintf("? Are you sure you want to delete namespace %q?", ns))
helper.SendLine(ctx, "Yes")
})
@@ -48,6 +51,7 @@ var _ = Describe("doc command reference odo delete namespace", func() {
got := helper.StripAnsi(out)
got = helper.StripInteractiveQuestion(got)
got = fmt.Sprintf(outputStringFormat, args[1], helper.StripSpinner(got))
got = strings.ReplaceAll(got, ns, "odo-dev")
file := "delete_namespace.mdx"
want := helper.GetMDXContent(filepath.Join(commonPath, file))
diff := cmp.Diff(want, got)
@@ -55,9 +59,9 @@ var _ = Describe("doc command reference odo delete namespace", func() {
})
It("Deletes a project resource for a openshift cluster", func() {
args := []string{"odo", "delete", "project", "odo-dev"}
args := []string{"odo", "delete", "project", ns}
out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) {
helper.ExpectString(ctx, "? Are you sure you want to delete project \"odo-dev\"?")
helper.ExpectString(ctx, fmt.Sprintf("? Are you sure you want to delete project %q?", ns))
helper.SendLine(ctx, "Yes")
})
@@ -65,6 +69,7 @@ var _ = Describe("doc command reference odo delete namespace", func() {
got := helper.StripAnsi(out)
got = helper.StripInteractiveQuestion(got)
got = fmt.Sprintf(outputStringFormat, args[1], helper.StripSpinner(got))
got = strings.ReplaceAll(got, ns, "odo-dev")
file := "delete_project.mdx"
want := helper.GetMDXContent(filepath.Join(commonPath, file))
diff := cmp.Diff(want, got)

View File

@@ -41,6 +41,11 @@ var _ = Describe("doc command reference odo init", Label(helper.LabelNoCluster),
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "java-maven") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")

View File

@@ -16,30 +16,31 @@ var _ = Describe("User guides: Quickstart test", func() {
var commonVar helper.CommonVar
var commonPath = filepath.Join("user-guides", "quickstart", "docs-mdx")
var outputStringFormat = "```console\n$ odo %s\n%s```\n"
const namespace = "odo-dev"
BeforeEach(func() {
commonVar = helper.CommonBeforeEach()
helper.Chdir(commonVar.Context)
})
AfterEach(func() {
helper.CommonAfterEach(commonVar)
})
Context("Create namespace/project", func() {
var namespace string
BeforeEach(func() {
// ensure "odo-dev" namespace does not exist before beginning
if commonVar.CliRunner.HasNamespaceProject(namespace) {
commonVar.CliRunner.DeleteNamespaceProject(namespace, true)
}
namespace = helper.GenerateProjectName()
})
AfterEach(func() {
helper.DeleteProject(namespace)
if commonVar.CliRunner.HasNamespaceProject(namespace) {
helper.DeleteProject(namespace)
}
})
It("should show correct output for namespace/project creation", func() {
args := []string{"create", "namespace", namespace}
out := helper.Cmd("odo", args...).ShouldPass().Out()
got := fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(out))
got = strings.ReplaceAll(got, namespace, "odo-dev")
By("checking the output for namespace", func() {
file := filepath.Join(commonPath, "create_namespace_output.mdx")
want := helper.GetMDXContent(file)
@@ -69,7 +70,7 @@ var _ = Describe("User guides: Quickstart test", func() {
helper.ExpectString(ctx, "Is this correct?")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "✓ Downloading devfile \"nodejs:2.1.1\" from registry \"DefaultDevfileRegistry\"")
helper.ExpectString(ctx, "✓ Downloading devfile \"nodejs")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -97,7 +98,7 @@ var _ = Describe("User guides: Quickstart test", func() {
args := []string{"dev"}
got := strings.ReplaceAll(devSession.StdOut, commonVar.Context, "/home/user/quickstart-demo")
got = helper.ReplaceAllForwardedPorts(got, devSession.Endpoints, map[string]string{"3000": "127.0.0.1:20001", "5858": "127.0.0.1:20002"})
got = strings.ReplaceAll(got, commonVar.Project, namespace)
got = strings.ReplaceAll(got, commonVar.Project, "odo-dev")
got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got))
got = helper.StripGitCommitFromVersion(got)
file := filepath.Join(commonNodeJSPath, "nodejs_odo_dev_output.mdx")
@@ -119,7 +120,7 @@ var _ = Describe("User guides: Quickstart test", func() {
helper.ExpectString(ctx, "Is this correct?")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "✓ Downloading devfile \"go:1.0.2\" from registry \"DefaultDevfileRegistry\"")
helper.ExpectString(ctx, "✓ Downloading devfile \"go")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -147,7 +148,7 @@ var _ = Describe("User guides: Quickstart test", func() {
args := []string{"dev"}
got := strings.ReplaceAll(devSession.StdOut, commonVar.Context, "/home/user/quickstart-demo")
got = helper.ReplaceAllForwardedPorts(got, devSession.Endpoints, map[string]string{"8080": "127.0.0.1:20001"})
got = strings.ReplaceAll(got, commonVar.Project, namespace)
got = strings.ReplaceAll(got, commonVar.Project, "odo-dev")
got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got))
got = helper.StripGitCommitFromVersion(got)
file := filepath.Join(commonGoPath, "go_odo_dev_output.mdx")
@@ -179,7 +180,12 @@ var _ = Describe("User guides: Quickstart test", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "6")
helper.ExpectString(ctx, "✓ Downloading devfile \"dotnet60\" from registry \"DefaultDevfileRegistry\"")
if helper.HasAtLeastTwoVersions("", "dotnet60") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "✓ Downloading devfile \"dotnet60")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -192,7 +198,6 @@ var _ = Describe("User guides: Quickstart test", func() {
Expect(err).To(BeNil())
got := helper.StripAnsi(out)
got = helper.StripInteractiveQuestion(got)
got = strings.ReplaceAll(got, commonVar.Project, namespace)
got = fmt.Sprintf(outputStringFormat, "init", helper.StripSpinner(got))
got = helper.StripGitCommitFromVersion(got)
file := filepath.Join(commondotnetPath, "dotnet_odo_init_output.mdx")
@@ -208,7 +213,7 @@ var _ = Describe("User guides: Quickstart test", func() {
args := []string{"dev"}
got := strings.ReplaceAll(devSession.StdOut, commonVar.Context, "/home/user/quickstart-demo")
got = helper.ReplaceAllForwardedPorts(got, devSession.Endpoints, map[string]string{"8080": "127.0.0.1:20001"})
got = strings.ReplaceAll(got, commonVar.Project, namespace)
got = strings.ReplaceAll(got, commonVar.Project, "odo-dev")
got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got))
got = helper.StripGitCommitFromVersion(got)
file := filepath.Join(commondotnetPath, "dotnet_odo_dev_output.mdx")
@@ -230,7 +235,7 @@ var _ = Describe("User guides: Quickstart test", func() {
helper.ExpectString(ctx, "Is this correct?")
helper.SendLine(ctx, "Yes")
helper.ExpectString(ctx, "✓ Downloading devfile \"java-springboot:1.2.0\" from registry \"DefaultDevfileRegistry\"")
helper.ExpectString(ctx, "✓ Downloading devfile \"java-springboot")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -261,7 +266,7 @@ var _ = Describe("User guides: Quickstart test", func() {
args := []string{"dev"}
got := strings.ReplaceAll(devSession.StdOut, commonVar.Context, "/home/user/quickstart-demo")
got = helper.ReplaceAllForwardedPorts(got, devSession.Endpoints, map[string]string{"8080": "127.0.0.1:20001", "5858": "127.0.0.1:20002"})
got = strings.ReplaceAll(got, commonVar.Project, namespace)
got = strings.ReplaceAll(got, commonVar.Project, "odo-dev")
got = fmt.Sprintf(outputStringFormat, strings.Join(args, " "), helper.StripSpinner(got))
got = helper.StripGitCommitFromVersion(got)
file := filepath.Join(commonGoPath, "java_odo_dev_output.mdx")

View File

@@ -8,7 +8,6 @@ import (
"net/http"
"path"
"path/filepath"
"regexp"
"time"
. "github.com/onsi/ginkgo/v2"
@@ -48,18 +47,6 @@ var _ = Describe("E2E Test", func() {
}
Context("starting with empty Directory", func() {
var hasMultipleVersions bool
var _ = BeforeEach(func() {
helper.Chdir(commonVar.Context)
Expect(helper.ListFilesInDir(commonVar.Context)).To(BeEmpty())
out := helper.Cmd("odo", "registry", "--devfile", "nodejs", "--devfile-registry", "DefaultDevfileRegistry").ShouldPass().Out()
// Version pattern has always been in the form of X.X.X
vMatch := regexp.MustCompile(`(?:\d.\d.\d)`)
if matches := vMatch.FindAll([]byte(out), -1); len(matches) > 1 {
hasMultipleVersions = true
}
})
It("should verify developer workflow from empty Directory", func() {
deploymentName := "my-component"
serviceName := "my-cs"
@@ -78,7 +65,7 @@ var _ = Describe("E2E Test", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "Node.js")
if hasMultipleVersions {
if helper.HasAtLeastTwoVersions("", "nodejs") {
helper.ExpectString(ctx, "Select version: ")
helper.SendLine(ctx, "")
}

View File

@@ -233,6 +233,7 @@ func CommonBeforeEach() CommonVar {
}
}
commonVar.OriginalWorkingDirectory = Getwd()
Chdir(commonVar.Context)
configPath := filepath.Join(commonVar.ConfigDir, "preference.yaml")
os.Setenv("GLOBALODOCONFIG", configPath)
@@ -401,14 +402,11 @@ func SetDefaultDevfileRegistryAsStaging() {
func GetDevfileRegistryURL() string {
registryURL := "https://registry.stage.devfile.io"
proxy := os.Getenv("DEVFILE_PROXY")
if proxy != "" {
registryURL = "http://" + proxy
}
customReg := os.Getenv("DEVFILE_REGISTRY")
if customReg != "" {
registryURL = customReg
}
fmt.Printf("Using Devfile Registry URL at: %q\n", registryURL)
return registryURL
}

View File

@@ -5,12 +5,16 @@ import (
"fmt"
"net/http"
"net/url"
"regexp"
. "github.com/onsi/ginkgo/v2"
"github.com/redhat-developer/odo/pkg/api"
)
// Version pattern has always been in the form of X.X.X
var versionRe = regexp.MustCompile(`(\d.\d.\d)`)
type Registry struct {
url string
}
@@ -56,3 +60,25 @@ func (o Registry) GetStack(name string) (api.DevfileStack, error) {
}
return api.DevfileStack{}, fmt.Errorf("stack %q not found", name)
}
// GetVersions returns the list of all versions for the given stack name in the given Devfile registry.
// It uses the "odo registry" command to find out this information.
//
// The registry name is optional, and defaults to DefaultDevfileRegistry if not set.
func GetVersions(registryName string, stackName string) []string {
devfileReg := "DefaultDevfileRegistry"
if registryName != "" {
devfileReg = registryName
}
out := Cmd("odo", "registry", "--devfile", stackName, "--devfile-registry", devfileReg).ShouldPass().Out()
return versionRe.FindAllString(out, -1)
}
// HasAtLeastTwoVersions returns whether the given stack in the given Devfile registry has at least two versions.
// This is useful to determine if the "Select version" prompt will be displayed in the interactive "odo init" tests.
// Otherwise, "odo init" would just skip this "Select version" prompt if the stack selected has no version or only a single one.
//
// Note that the registry name is optional, and defaults to DefaultDevfileRegistry if not set.
func HasAtLeastTwoVersions(registryName string, stackName string) bool {
return len(GetVersions(registryName, stackName)) >= 2
}

View File

@@ -2,7 +2,6 @@ package integration
import (
"fmt"
"os"
"path/filepath"
. "github.com/onsi/ginkgo/v2"
@@ -37,15 +36,7 @@ var _ = Describe("odo devfile registry command tests", func() {
const registryName string = "RegistryName"
// Use staging OCI-based registry for tests to avoid overload
var addRegistryURL string = "https://registry.stage.devfile.io"
proxy := os.Getenv("DEVFILE_PROXY")
if proxy != "" {
addRegistryURL = "http://" + proxy
}
customDevfileRegistry := os.Getenv("DEVFILE_REGISTRY")
if customDevfileRegistry != "" {
addRegistryURL = customDevfileRegistry
}
addRegistryURL := helper.GetDevfileRegistryURL()
It("Should list all default registries", func() {
output := helper.Cmd("odo", "preference", "view").ShouldPass().Out()

View File

@@ -174,8 +174,10 @@ var _ = Describe("odo dev interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "Python")
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "python") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")

View File

@@ -5,7 +5,6 @@ import (
"log"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
@@ -64,8 +63,10 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "go") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -84,68 +85,57 @@ var _ = Describe("odo init interactive command tests", func() {
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))
})
Context("personalizing Devfile configuration", func() {
var hasMultipleVersions bool
BeforeEach(func() {
out := helper.Cmd("odo", "registry", "--devfile", "nodejs", "--devfile-registry", "DefaultDevfileRegistry").ShouldPass().Out()
// Version pattern has always been in the form of X.X.X
vMatch := regexp.MustCompile(`(\d.\d.\d)`)
if matches := vMatch.FindAll([]byte(out), -1); len(matches) > 1 {
hasMultipleVersions = true
}
})
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) {
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 architectures")
helper.ExpectString(ctx, "Select architectures")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Javascript")
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "nodejs") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select language")
helper.SendLine(ctx, "Javascript")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.ExpectString(ctx, "runtime")
helper.SendLine(ctx, "runtime")
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete port \"3000\"")
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, "Enter port number:")
helper.SendLine(ctx, "3000")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.ExpectString(ctx, "runtime")
helper.SendLine(ctx, "runtime")
helper.ExpectString(ctx, "What configuration do you want change")
// Default option is NOTHING - configuration is correct
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "What configuration do you want change")
helper.SendLine(ctx, "Delete port \"3000\"")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
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, "Which starter project do you want to use")
helper.SendLine(ctx, "nodejs-starter")
helper.ExpectString(ctx, "What configuration do you want change")
// Default option is NOTHING - configuration is correct
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Enter component name:")
helper.SendLine(ctx, "my-nodejs-app")
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Your new component 'my-nodejs-app' is ready in the current directory.")
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.")
})
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"), "3000")
})
})
@@ -162,8 +152,10 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "go") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -209,8 +201,10 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "go") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -250,8 +244,10 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "go") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -288,8 +284,10 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, devfileVersion)
if helper.HasAtLeastTwoVersions("", "go") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, devfileVersion)
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -327,6 +325,11 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "Vert.x Java")
if helper.HasAtLeastTwoVersions("", "java-vertx") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -428,6 +431,11 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "java-maven") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -588,6 +596,11 @@ var _ = Describe("odo init interactive command tests", func() {
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "dotnet50") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -737,6 +750,11 @@ spec:
helper.ExpectString(ctx, "Select project type")
helper.SendLine(ctx, "")
if helper.HasAtLeastTwoVersions("", "java-maven") {
helper.ExpectString(ctx, "Select version")
helper.SendLine(ctx, "")
}
helper.ExpectString(ctx, "Select container for which you want to change configuration?")
helper.SendLine(ctx, "")
@@ -751,8 +769,12 @@ spec:
Expect(err).ShouldNot(HaveOccurred())
By("displaying automation command with the in-cluster registry", func() {
Expect(output).Should(ContainSubstring(
"odo init --name my-java-maven-app --devfile java-maven --devfile-registry %s --starter springbootproject", devfileRegistryName))
Expect(output).Should(
ContainSubstring(
"odo init --name my-java-maven-app --devfile java-maven --devfile-registry %s --devfile-version 1.2.0 --starter springbootproject",
devfileRegistryName,
),
output)
})
By("actually downloading the Devfile", func() {
Expect(helper.ListFilesInDir(commonVar.Context)).To(ContainElements("devfile.yaml"))