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-e2e-devfile
|
||||
make test-cmd-project
|
||||
make test-generic
|
||||
) |& tee "/tmp/${LOGFILE}"
|
||||
|
||||
RESULT=${PIPESTATUS[0]}
|
||||
|
||||
save_logs "${LOGFILE}" "Kubernetes Tests" ${RESULT}
|
||||
|
||||
@@ -21,6 +21,7 @@ cleanup_namespaces
|
||||
make test-cmd-project
|
||||
make test-e2e-devfile
|
||||
) |& tee "/tmp/${LOGFILE}"
|
||||
|
||||
RESULT=${PIPESTATUS[0]}
|
||||
|
||||
save_logs "${LOGFILE}" "OpenShift Tests" ${RESULT}
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
@@ -27,28 +26,30 @@ var _ = Describe("odo generic", func() {
|
||||
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'"))
|
||||
})
|
||||
|
||||
It("Make sure we have the full description when performing odo --help", func() {
|
||||
output := helper.Cmd("odo", "--help").ShouldPass().Out()
|
||||
Expect(output).To(ContainSubstring("Use \"odo [command] --help\" for more information about a command."))
|
||||
})
|
||||
|
||||
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() {
|
||||
It("returns error when using an invalid command", func() {
|
||||
output := helper.Cmd("odo", "hello").ShouldFail().Err()
|
||||
Expect(strings.Count(output, "odo [flags]")).Should(Equal(1))
|
||||
})
|
||||
|
||||
Expect(output).To(ContainSubstring("Invalid command - see available commands/subcommands above"))
|
||||
})
|
||||
|
||||
Context("When deleting two project one after the other", func() {
|
||||
@@ -56,35 +57,37 @@ var _ = Describe("odo generic", func() {
|
||||
project1 := helper.CreateRandProject()
|
||||
project2 := helper.CreateRandProject()
|
||||
|
||||
helper.DeleteProject(project2)
|
||||
helper.DeleteProject(project1)
|
||||
helper.DeleteProject(project2)
|
||||
})
|
||||
})
|
||||
|
||||
Context("When deleting three project one after the other in opposite order", func() {
|
||||
It("should be able to delete", func() {
|
||||
It("should be able to delete them in any order", func() {
|
||||
project1 := helper.CreateRandProject()
|
||||
project2 := helper.CreateRandProject()
|
||||
project3 := helper.CreateRandProject()
|
||||
|
||||
helper.DeleteProject(project1)
|
||||
helper.DeleteProject(project2)
|
||||
helper.DeleteProject(project1)
|
||||
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() {
|
||||
odoVersion := helper.Cmd("odo", "version").ShouldPass().Out()
|
||||
reOdoVersion := regexp.MustCompile(`^odo\s*v[0-9]+.[0-9]+.[0-9]+(?:-\w+)?\s*\(\w+\)`)
|
||||
odoVersionStringMatch := reOdoVersion.MatchString(odoVersion)
|
||||
Expect(odoVersionStringMatch).Should(BeTrue())
|
||||
if !helper.IsKubernetesCluster() {
|
||||
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(kubernetesVersionStringMatch).Should(BeTrue())
|
||||
serverURL := oc.GetCurrentServerURL()
|
||||
Expect(odoVersion).Should(ContainSubstring("Server: " + serverURL))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user