mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* 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
81 lines
2.4 KiB
Go
81 lines
2.4 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 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)
|
|
ns = helper.GenerateProjectName()
|
|
})
|
|
|
|
AfterEach(func() {
|
|
helper.CommonAfterEach(commonVar)
|
|
})
|
|
|
|
Context("To delete a namespace resource", func() {
|
|
|
|
BeforeEach(func() {
|
|
helper.Cmd("odo", "create", "namespace", ns).ShouldPass()
|
|
})
|
|
|
|
AfterEach(func() {
|
|
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", ns}
|
|
out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) {
|
|
helper.ExpectString(ctx, fmt.Sprintf("? Are you sure you want to delete namespace %q?", ns))
|
|
helper.SendLine(ctx, "Yes")
|
|
|
|
})
|
|
Expect(err).To(BeNil())
|
|
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)
|
|
Expect(diff).To(BeEmpty(), file)
|
|
})
|
|
|
|
It("Deletes a project resource for a openshift cluster", func() {
|
|
args := []string{"odo", "delete", "project", ns}
|
|
out, err := helper.RunInteractive(args, []string{"ODO_LOG_LEVEL=0"}, func(ctx helper.InteractiveContext) {
|
|
helper.ExpectString(ctx, fmt.Sprintf("? Are you sure you want to delete project %q?", ns))
|
|
helper.SendLine(ctx, "Yes")
|
|
|
|
})
|
|
Expect(err).To(BeNil())
|
|
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)
|
|
Expect(diff).To(BeEmpty(), file)
|
|
})
|
|
|
|
})
|
|
})
|