mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
refactoring generic-test (#5628)
* rebasing * Incorporated additional feedback, removed make test-generic from openshift-tests.sh as it runs test-integration
This commit is contained in:
@@ -17,7 +17,9 @@ cleanup_namespaces
|
|||||||
make test-interactive
|
make test-interactive
|
||||||
make test-e2e-devfile
|
make test-e2e-devfile
|
||||||
make test-cmd-project
|
make test-cmd-project
|
||||||
|
make test-generic
|
||||||
) |& tee "/tmp/${LOGFILE}"
|
) |& tee "/tmp/${LOGFILE}"
|
||||||
|
|
||||||
RESULT=${PIPESTATUS[0]}
|
RESULT=${PIPESTATUS[0]}
|
||||||
|
|
||||||
save_logs "${LOGFILE}" "Kubernetes Tests" ${RESULT}
|
save_logs "${LOGFILE}" "Kubernetes Tests" ${RESULT}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ cleanup_namespaces
|
|||||||
make test-cmd-project
|
make test-cmd-project
|
||||||
make test-e2e-devfile
|
make test-e2e-devfile
|
||||||
) |& tee "/tmp/${LOGFILE}"
|
) |& tee "/tmp/${LOGFILE}"
|
||||||
|
|
||||||
RESULT=${PIPESTATUS[0]}
|
RESULT=${PIPESTATUS[0]}
|
||||||
|
|
||||||
save_logs "${LOGFILE}" "OpenShift Tests" ${RESULT}
|
save_logs "${LOGFILE}" "OpenShift Tests" ${RESULT}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package integration
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
@@ -27,28 +26,30 @@ var _ = Describe("odo generic", func() {
|
|||||||
helper.CommonAfterEach(commonVar)
|
helper.CommonAfterEach(commonVar)
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("Check the help usage for odo", func() {
|
When("running odo --help", func() {
|
||||||
|
var output string
|
||||||
|
BeforeEach(func() {
|
||||||
|
output = helper.Cmd("odo", "--help").ShouldPass().Out()
|
||||||
|
})
|
||||||
|
It("retuns full help contents including usage, examples, commands, utility commands, component shortcuts, and flags sections", func() {
|
||||||
|
helper.MatchAllInOutput(output, []string{"Usage:", "Examples:", "Main Commands:", "OpenShift Commands:", "Utility Commands:", "Flags:"})
|
||||||
|
})
|
||||||
|
|
||||||
It("Makes sure that we have the long-description when running odo and we dont error", func() {
|
})
|
||||||
output := helper.Cmd("odo").ShouldPass().Out()
|
|
||||||
|
When("running odo without subcommand and flags", func() {
|
||||||
|
var output string
|
||||||
|
BeforeEach(func() {
|
||||||
|
output = helper.Cmd("odo").ShouldPass().Out()
|
||||||
|
})
|
||||||
|
It("a short vesion of help contents is returned, an error is not expected", func() {
|
||||||
Expect(output).To(ContainSubstring("To see a full list of commands, run 'odo --help'"))
|
Expect(output).To(ContainSubstring("To see a full list of commands, run 'odo --help'"))
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
It("Make sure we have the full description when performing odo --help", func() {
|
It("returns error when using an invalid command", func() {
|
||||||
output := helper.Cmd("odo", "--help").ShouldPass().Out()
|
output := helper.Cmd("odo", "hello").ShouldFail().Err()
|
||||||
Expect(output).To(ContainSubstring("Use \"odo [command] --help\" for more information about a command."))
|
Expect(output).To(ContainSubstring("Invalid command - see available commands/subcommands above"))
|
||||||
})
|
|
||||||
|
|
||||||
It("Fail when entering an incorrect name for a component", func() {
|
|
||||||
output := helper.Cmd("odo", "delete", "foobar").ShouldFail().Err()
|
|
||||||
Expect(output).To(ContainSubstring("Subcommand not found, use one of the available commands"))
|
|
||||||
})
|
|
||||||
|
|
||||||
It("Fail with showing help only once for incorrect command", func() {
|
|
||||||
output := helper.Cmd("odo", "hello").ShouldFail().Err()
|
|
||||||
Expect(strings.Count(output, "odo [flags]")).Should(Equal(1))
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("When deleting two project one after the other", func() {
|
Context("When deleting two project one after the other", func() {
|
||||||
@@ -56,35 +57,37 @@ var _ = Describe("odo generic", func() {
|
|||||||
project1 := helper.CreateRandProject()
|
project1 := helper.CreateRandProject()
|
||||||
project2 := helper.CreateRandProject()
|
project2 := helper.CreateRandProject()
|
||||||
|
|
||||||
helper.DeleteProject(project2)
|
|
||||||
helper.DeleteProject(project1)
|
helper.DeleteProject(project1)
|
||||||
|
helper.DeleteProject(project2)
|
||||||
})
|
})
|
||||||
})
|
It("should be able to delete them in any order", func() {
|
||||||
|
|
||||||
Context("When deleting three project one after the other in opposite order", func() {
|
|
||||||
It("should be able to delete", func() {
|
|
||||||
project1 := helper.CreateRandProject()
|
project1 := helper.CreateRandProject()
|
||||||
project2 := helper.CreateRandProject()
|
project2 := helper.CreateRandProject()
|
||||||
project3 := helper.CreateRandProject()
|
project3 := helper.CreateRandProject()
|
||||||
|
|
||||||
helper.DeleteProject(project1)
|
|
||||||
helper.DeleteProject(project2)
|
helper.DeleteProject(project2)
|
||||||
|
helper.DeleteProject(project1)
|
||||||
helper.DeleteProject(project3)
|
helper.DeleteProject(project3)
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("when executing odo version command", func() {
|
When("executing odo version command", func() {
|
||||||
|
var odoVersion string
|
||||||
|
BeforeEach(func() {
|
||||||
|
odoVersion = helper.Cmd("odo", "version").ShouldPass().Out()
|
||||||
|
})
|
||||||
|
|
||||||
It("should show the version of odo major components including server login URL", func() {
|
It("should show the version of odo major components including server login URL", func() {
|
||||||
odoVersion := helper.Cmd("odo", "version").ShouldPass().Out()
|
|
||||||
reOdoVersion := regexp.MustCompile(`^odo\s*v[0-9]+.[0-9]+.[0-9]+(?:-\w+)?\s*\(\w+\)`)
|
reOdoVersion := regexp.MustCompile(`^odo\s*v[0-9]+.[0-9]+.[0-9]+(?:-\w+)?\s*\(\w+\)`)
|
||||||
odoVersionStringMatch := reOdoVersion.MatchString(odoVersion)
|
odoVersionStringMatch := reOdoVersion.MatchString(odoVersion)
|
||||||
rekubernetesVersion := regexp.MustCompile(`Kubernetes:\s*v[0-9]+.[0-9]+.[0-9]+((-\w+\.[0-9]+)?\+\w+)?`)
|
|
||||||
kubernetesVersionStringMatch := rekubernetesVersion.MatchString(odoVersion)
|
|
||||||
Expect(odoVersionStringMatch).Should(BeTrue())
|
Expect(odoVersionStringMatch).Should(BeTrue())
|
||||||
Expect(kubernetesVersionStringMatch).Should(BeTrue())
|
if !helper.IsKubernetesCluster() {
|
||||||
serverURL := oc.GetCurrentServerURL()
|
rekubernetesVersion := regexp.MustCompile(`Kubernetes:\s*v[0-9]+.[0-9]+.[0-9]+((-\w+\.[0-9]+)?\+\w+)?`)
|
||||||
Expect(odoVersion).Should(ContainSubstring("Server: " + serverURL))
|
kubernetesVersionStringMatch := rekubernetesVersion.MatchString(odoVersion)
|
||||||
|
Expect(kubernetesVersionStringMatch).Should(BeTrue())
|
||||||
|
serverURL := oc.GetCurrentServerURL()
|
||||||
|
Expect(odoVersion).Should(ContainSubstring("Server: " + serverURL))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user