Files
odo/tests/documentation/command-reference/doc_command_reference_createnamespace_test.go
Armel Soro 5d4a6ef325 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
2023-10-27 07:54:14 +00:00

63 lines
1.8 KiB
Go

package docautomation
import (
"fmt"
"path/filepath"
"strings"
"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/tests/helper"
)
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)
ns = helper.GenerateProjectName()
})
AfterEach(func() {
helper.CommonAfterEach(commonVar)
})
Context("To create a namespace resource", func() {
AfterEach(func() {
if commonVar.CliRunner.HasNamespaceProject(ns) {
commonVar.CliRunner.DeleteNamespaceProject(ns, false)
}
})
It("Creates a namespace resource for a kubernetes cluster", func() {
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)
Expect(diff).To(BeEmpty(), file)
})
It("Creates a project resource for a kubernetes cluster", func() {
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)
Expect(diff).To(BeEmpty(), file)
})
})
})