reduce test make targets, organize test file structure (#5931)

* reduce test make targets, organize test file structure

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* remove report collection

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
This commit is contained in:
Anand Kumar Singh
2022-07-13 11:02:11 +05:30
committed by GitHub
parent 2ae27e9dcd
commit c7f3f3b1d1
33 changed files with 71 additions and 421 deletions

View File

@@ -9,15 +9,12 @@ ibmcloud target -r "${IBM_REGION}"
ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin
cleanup_namespaces cleanup_namespaces
export SKIP_USER_LOGIN_TESTS=true
( (
set -e set -e
make install make install
make test-integration-devfile make test-integration
make test-interactive make test-e2e
make test-e2e-devfile
make test-cmd-project
make test-generic
) |& tee "/tmp/${LOGFILE}" ) |& tee "/tmp/${LOGFILE}"
RESULT=${PIPESTATUS[0]} RESULT=${PIPESTATUS[0]}

View File

@@ -15,11 +15,7 @@ cleanup_namespaces
set -e set -e
make install make install
make test-integration make test-integration
make test-interactive make test-e2e
make test-integration-devfile
make test-cmd-login-logout
make test-cmd-project
make test-e2e-devfile
) |& tee "/tmp/${LOGFILE}" ) |& tee "/tmp/${LOGFILE}"
RESULT=${PIPESTATUS[0]} RESULT=${PIPESTATUS[0]}

View File

@@ -67,15 +67,9 @@ function Run-Test {
Shout "Create Binary" Shout "Create Binary"
make install make install
Shout "Running test" Shout "Running test"
make test-integration-devfile | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-integration | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE make test-integration | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE Check-ExitCode $LASTEXITCODE
make test-cmd-login-logout | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE make test-e2e | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-cmd-project | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
make test-e2e-devfile | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE Check-ExitCode $LASTEXITCODE
Pop-Location Pop-Location

126
Makefile
View File

@@ -164,122 +164,6 @@ test:
test-windows: test-windows:
go test $(UNIT_TEST_ARGS) $(PKGS) go test $(UNIT_TEST_ARGS) $(PKGS)
.PHONY: test-generic
test-generic: install ## Run generic integration tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo generic" tests/integration/
.PHONY: test-cmd-login-logout
test-cmd-login-logout: install ## Run odo login and logout tests
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) -focus="odo login and logout command tests" tests/integration/loginlogout/
.PHONY: test-cmd-link-unlink-4-cluster
test-cmd-link-unlink-4-cluster: install ## Run link and unlink commnad tests against 4.x cluster
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo link and unlink commnad tests" tests/integration/
.PHONY: test-cmd-project
test-cmd-project: install ## Run odo project command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo project command tests" tests/integration/project/
.PHONY: test-cmd-pref-config
test-cmd-pref-config: install ## Run odo preference and config command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo preference and config command tests" tests/integration/
.PHONY: test-plugin-handler
test-plugin-handler: install ## Run odo plugin handler tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo plugin functionality" tests/integration/
.PHONY: test-cmd-devfile-list
test-cmd-devfile-list: install ## Run odo list devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo list with devfile" tests/integration/devfile/
.PHONY: test-cmd-devfile-init
test-cmd-devfile-init: install ## Run odo init devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile init command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-push
test-cmd-devfile-push: install ## Run odo push devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile push command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-exec
test-cmd-devfile-exec: install ## Run odo exec devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile exec command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-status
test-cmd-devfile-status: install ## Run odo status devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile status command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-watch
test-cmd-devfile-watch: install ## Run odo devfile watch command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile watch command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-app
test-cmd-devfile-app: install ## Run odo devfile app command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile app command tests" tests/integration/devfile/
.PHONY: test-cmd-delete
test-cmd-delete: install ## Run odo delete command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo delete command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-registry
test-cmd-devfile-registry: install ## Run odo devfile registry command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile registry command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-test
test-cmd-devfile-test: install ## Run odo devfile test command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile test command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-debug
test-cmd-devfile-debug: install ## Run odo debug devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile debug command tests" tests/integration/devfile/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) -focus="odo devfile debug command serial tests" tests/integration/devfile/debug/
.PHONY: test-cmd-devfile-storage
test-cmd-devfile-storage: install ## Run odo storage devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile storage command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-log
test-cmd-devfile-log: install ## Run odo log devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile log command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-env
test-cmd-devfile-env: install ## Run odo env devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile env command tests" tests/integration/devfile/
.PHONY: test-cmd-devfile-config
test-cmd-devfile-config: install ## Run odo config devfile command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile config command tests" tests/integration/devfile/
.PHONY: test-cmd-watch
test-cmd-watch: install ## Run odo watch command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo watch command tests" tests/integration/
.PHONY: test-cmd-debug
test-cmd-debug: install ## Run odo debug command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo debug command tests" tests/integration/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) -focus="odo debug command serial tests" tests/integration/debug/
# Service, link and login/logout command tests are not the part of this test run
.PHONY: test-integration
test-integration: install ## Run command's integration tests irrespective of service catalog status in the cluster.
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration/
.PHONY: test-interactive
test-interactive: install ## Run integration interactive tests
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/interactive/
.PHONY: test-integration-devfile
test-integration-devfile: install ## Run devfile integration tests
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration/devfile/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) tests/integration/devfile/debug/
.PHONY: test-e2e-devfile
test-e2e-devfile: install ## Run devfile e2e tests: odo devfile supported tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile supported tests" tests/e2escenarios/
.PHONY: test-e2e-all
test-e2e-all: install ## Run all e2e test scenarios
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/e2escenarios/
# run make cross before this! # run make cross before this!
.PHONY: packages .PHONY: packages
packages: ## create deb and rpm packages using fpm in ./dist/pkgs/ packages: ## create deb and rpm packages using fpm in ./dist/pkgs/
@@ -298,6 +182,10 @@ vendor-update: ## Update vendoring
openshiftci-presubmit-unittests: openshiftci-presubmit-unittests:
./scripts/openshiftci-presubmit-unittests.sh ./scripts/openshiftci-presubmit-unittests.sh
.PHONY: test-cmd-devfile-describe .PHONY: test-integration
test-cmd-devfile-describe: install test-integration:
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo devfile describe command tests" tests/integration/devfile/ $(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration
.PHONY: test-e2e
test-e2e:
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/e2escenarios

View File

@@ -30,6 +30,5 @@ oc whoami
# Operatorhub integration tests # Operatorhub integration tests
make test-operator-hub make test-operator-hub
cp -r tests/reports $ARTIFACT_DIR
oc logout oc logout

View File

@@ -28,20 +28,14 @@ oc whoami
# Integration tests # Integration tests
make test-integration || error=true make test-integration || error=true
make test-integration-devfile || error=true
make test-cmd-login-logout || error=true
make test-cmd-project || error=true
# Interactive tests
make test-interactive || error=true
# E2e tests # E2e tests
make test-e2e-all || error=true make test-e2e || error=true
if [ $error ]; then if [ $error ]; then
exit -1 exit -1
fi fi
cp -r reports tests/reports $ARTIFACT_DIR
oc logout oc logout

View File

@@ -1,68 +0,0 @@
#!/bin/sh
# fail if some commands fails
set -e
# show commands
set -x
ARCH=$(uname -m)
export CI="openshift"
if [ "${ARCH}" == "s390x" ]; then
make configure-installer-tests-cluster-s390x
elif [ "${ARCH}" == "ppc64le" ]; then
make configure-installer-tests-cluster-ppc64le
else
make configure-installer-tests-cluster
fi
make bin
mkdir -p $GOPATH/bin
make goget-ginkgo
export PATH="$PATH:$(pwd):$GOPATH/bin"
export CUSTOM_HOMEDIR=$ARTIFACT_DIR
# Copy kubeconfig to temporary kubeconfig file
# Read and Write permission to temporary kubeconfig file
TMP_DIR=$(mktemp -d)
cp $KUBECONFIG $TMP_DIR/kubeconfig
chmod 640 $TMP_DIR/kubeconfig
export KUBECONFIG=$TMP_DIR/kubeconfig
# Login as developer
oc login -u developer -p password@123
# Check login user name for debugging purpose
oc whoami
if [ "${ARCH}" == "s390x" ]; then
# Integration tests
make test-integration
make test-cmd-login-logout
make test-cmd-project
# E2e tests
make test-e2e-all
elif [ "${ARCH}" == "ppc64le" ]; then
# Integration tests
make test-integration
make test-cmd-login-logout
make test-cmd-project
# E2e tests
make test-e2e-all
else
# Integration tests
make test-integration || error=true
make test-integration-devfile || error=true
make test-cmd-login-logout || error=true
make test-cmd-project || error=true
# E2e tests
make test-e2e-all || error=true
# Fail the build if there is any error while test execution
if [ $error ]; then
exit -1
fi
fi
cp -r reports $ARTIFACT_DIR
oc logout

View File

@@ -35,32 +35,19 @@ oc whoami
if [ "${ARCH}" == "s390x" ]; then if [ "${ARCH}" == "s390x" ]; then
# Integration tests # Integration tests
make test-integration make test-integration
make test-integration-devfile
make test-cmd-login-logout
make test-cmd-project
# E2e tests # E2e tests
make test-e2e-all make test-e2e
elif [ "${ARCH}" == "ppc64le" ]; then elif [ "${ARCH}" == "ppc64le" ]; then
# Integration tests # Integration tests
make test-integration make test-integration
make test-integration-devfile
make test-cmd-login-logout
make test-cmd-project
# E2e tests # E2e tests
make test-e2e-all make test-e2e
else else
# Integration tests # Integration tests
make test-integration || error=true make test-integration || error=true
make test-interactive || error=true
make test-integration-devfile || error=true
make test-cmd-login-logout || error=true
make test-cmd-project || error=true
# Interactive tests
make test-interactive || error=true
# E2e tests # E2e tests
make test-e2e-all || error=true make test-e2e || error=true
# Fail the build if there is any error while test execution # Fail the build if there is any error while test execution
if [ $error ]; then if [ $error ]; then
@@ -68,6 +55,5 @@ else
fi fi
fi fi
cp -r reports tests/reports $ARTIFACT_DIR
oc logout oc logout

View File

@@ -65,3 +65,35 @@ func GetDevfileComponents(devfilePath, componentName string) []v1alpha2.Componen
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
return components return components
} }
type OdoV2Watch struct {
CmpName string
StringsToBeMatched []string
StringsNotToBeMatched []string
FolderToCheck string
SrcType string
}
// VerifyContainerSyncEnv verifies the sync env in the container
func VerifyContainerSyncEnv(podName, containerName, namespace, projectSourceValue, projectsRootValue string, cliRunner CliRunner) {
envProjectsRoot, envProjectSource := "PROJECTS_ROOT", "PROJECT_SOURCE"
projectSourceMatched, projectsRootMatched := false, false
envNamesAndValues := cliRunner.GetContainerEnv(podName, "runtime", namespace)
envNamesAndValuesArr := strings.Fields(envNamesAndValues)
for _, envNamesAndValues := range envNamesAndValuesArr {
envNameAndValueArr := strings.Split(envNamesAndValues, ":")
if envNameAndValueArr[0] == envProjectSource && strings.Contains(envNameAndValueArr[1], projectSourceValue) {
projectSourceMatched = true
}
if envNameAndValueArr[0] == envProjectsRoot && strings.Contains(envNameAndValueArr[1], projectsRootValue) {
projectsRootMatched = true
}
}
Expect(projectSourceMatched).To(Equal(true))
Expect(projectsRootMatched).To(Equal(true))
}

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"path/filepath" "path/filepath"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"os" "os"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"
@@ -22,7 +22,6 @@ import (
"github.com/onsi/gomega/gexec" "github.com/onsi/gomega/gexec"
"github.com/redhat-developer/odo/tests/helper" "github.com/redhat-developer/odo/tests/helper"
"github.com/redhat-developer/odo/tests/integration/devfile/utils"
) )
var _ = Describe("odo dev command tests", func() { var _ = Describe("odo dev command tests", func() {
@@ -960,7 +959,7 @@ var _ = Describe("odo dev command tests", func() {
helper.MatchAllInOutput(output, []string{"package.json"}) helper.MatchAllInOutput(output, []string{"package.json"})
// Verify the sync env variables are correct // Verify the sync env variables are correct
utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/webapp", "/apps", commonVar.CliRunner) helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/webapp", "/apps", commonVar.CliRunner)
}) })
}) })
@@ -988,7 +987,7 @@ var _ = Describe("odo dev command tests", func() {
helper.MatchAllInOutput(output, []string{"package.json"}) helper.MatchAllInOutput(output, []string{"package.json"})
// Verify the sync env variables are correct // Verify the sync env variables are correct
utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/nodeshift", "/apps", commonVar.CliRunner) helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/apps/nodeshift", "/apps", commonVar.CliRunner)
}) })
}) })
@@ -1015,7 +1014,7 @@ var _ = Describe("odo dev command tests", func() {
helper.MatchAllInOutput(output, []string{"package.json"}) helper.MatchAllInOutput(output, []string{"package.json"})
// Verify the sync env variables are correct // Verify the sync env variables are correct
utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects/webapp", "/projects", commonVar.CliRunner) helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects/webapp", "/projects", commonVar.CliRunner)
}) })
}) })
@@ -1041,7 +1040,7 @@ var _ = Describe("odo dev command tests", func() {
helper.MatchAllInOutput(output, []string{"package.json"}) helper.MatchAllInOutput(output, []string{"package.json"})
// Verify the sync env variables are correct // Verify the sync env variables are correct
utils.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects", "/projects", commonVar.CliRunner) helper.VerifyContainerSyncEnv(podName, "runtime", commonVar.Project, "/projects", "/projects", commonVar.CliRunner)
}) })
}) })

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"path" "path"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"path/filepath" "path/filepath"

View File

@@ -1,4 +1,4 @@
package devfile package integration
import ( import (
"path/filepath" "path/filepath"

View File

@@ -1,11 +0,0 @@
package debug
import (
"testing"
"github.com/redhat-developer/odo/tests/helper"
)
func TestDebug(t *testing.T) {
helper.RunTestSpecs(t, "Devfile Debug Suite")
}

View File

@@ -1,11 +0,0 @@
package devfile
import (
"testing"
"github.com/redhat-developer/odo/tests/helper"
)
func TestDevfiles(t *testing.T) {
helper.RunTestSpecs(t, "Devfile Suite")
}

View File

@@ -1,41 +0,0 @@
package utils
import (
"strings"
"github.com/redhat-developer/odo/tests/helper"
. "github.com/onsi/gomega"
)
type OdoV2Watch struct {
CmpName string
StringsToBeMatched []string
StringsNotToBeMatched []string
FolderToCheck string
SrcType string
}
// VerifyContainerSyncEnv verifies the sync env in the container
func VerifyContainerSyncEnv(podName, containerName, namespace, projectSourceValue, projectsRootValue string, cliRunner helper.CliRunner) {
envProjectsRoot, envProjectSource := "PROJECTS_ROOT", "PROJECT_SOURCE"
projectSourceMatched, projectsRootMatched := false, false
envNamesAndValues := cliRunner.GetContainerEnv(podName, "runtime", namespace)
envNamesAndValuesArr := strings.Fields(envNamesAndValues)
for _, envNamesAndValues := range envNamesAndValuesArr {
envNameAndValueArr := strings.Split(envNamesAndValues, ":")
if envNameAndValueArr[0] == envProjectSource && strings.Contains(envNameAndValueArr[1], projectSourceValue) {
projectSourceMatched = true
}
if envNameAndValueArr[0] == envProjectsRoot && strings.Contains(envNameAndValueArr[1], projectsRootValue) {
projectsRootMatched = true
}
}
Expect(projectSourceMatched).To(Equal(true))
Expect(projectsRootMatched).To(Equal(true))
}

View File

@@ -1,7 +1,7 @@
//go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
// +build linux darwin dragonfly solaris openbsd netbsd freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd
package interactive package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,7 +1,7 @@
//go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
// +build linux darwin dragonfly solaris openbsd netbsd freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd
package interactive package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,7 +1,7 @@
//go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
// +build linux darwin dragonfly solaris openbsd netbsd freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd
package interactive package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,7 +1,7 @@
//go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
// +build linux darwin dragonfly solaris openbsd netbsd freebsd // +build linux darwin dragonfly solaris openbsd netbsd freebsd
package interactive package integration
import ( import (
"fmt" "fmt"

View File

@@ -1,78 +0,0 @@
package project
import (
"os"
"strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo project command tests", func() {
var commonVar helper.CommonVar
// This is run before every Spec (It)
var _ = BeforeEach(func() {
commonVar = helper.CommonBeforeEach()
})
// Clean up after the test
// This is run after every Spec (It)
var _ = AfterEach(func() {
helper.CommonAfterEach(commonVar)
})
It("should display the help of project command", func() {
projectHelp := helper.Cmd("odo", "project", "-h").ShouldPass().Out()
Expect(projectHelp).To(ContainSubstring("Perform project operations"))
})
It("should display only the project name when running command with -q flag", func() {
projectName := helper.Cmd("odo", "project", "get", "-q").ShouldPass().Out()
Expect(projectName).Should(Equal(commonVar.Project))
})
It("should list current empty project", func() {
helper.WaitForCmdOut("odo", []string{"project", "list"}, 1, true, func(output string) bool {
return strings.Contains(output, commonVar.Project)
})
})
When("creating a new project", func() {
var projectName string
BeforeEach(func() {
projectName = "cmd-project-" + helper.RandString(6)
helper.Cmd("odo", "project", "create", projectName).ShouldPass()
})
It("should delete a project with --wait", func() {
output := helper.Cmd("odo", "project", "delete", projectName, "-f", "--wait").ShouldPass().Out()
Expect(output).To(ContainSubstring("Waiting for project to be deleted"))
})
})
When("user is logged out", func() {
var token string
BeforeEach(func() {
if os.Getenv("KUBERNETES") == "true" {
Skip("Openshift specific scenario.")
}
ocRunner := helper.NewOcRunner("oc")
token = ocRunner.GetToken()
helper.Cmd("odo", "logout").ShouldPass()
})
AfterEach(func() {
helper.Cmd("odo", "login", "--token", token).ShouldPass()
})
It("should show login message when setting project and not login", func() {
err := helper.Cmd("odo", "project", "set", "something").ShouldFail().Err()
Expect(err).To(ContainSubstring("Unauthorized to access the cluster"))
})
It("should show login message when deleting project and not login", func() {
err := helper.Cmd("odo", "project", "delete", "something").ShouldFail().Err()
Expect(err).To(ContainSubstring("Unauthorized to access the cluster"))
})
})
})

View File

@@ -1,11 +0,0 @@
package project
import (
"testing"
"github.com/redhat-developer/odo/tests/helper"
)
func TestProject(t *testing.T) {
helper.RunTestSpecs(t, "Project Suite")
}

View File

@@ -1,15 +0,0 @@
//go:build !race && (linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd)
// +build !race
// +build linux darwin dragonfly solaris openbsd netbsd freebsd
package interactive
import (
"testing"
"github.com/redhat-developer/odo/tests/helper"
)
func TestInteractive(t *testing.T) {
helper.RunTestSpecs(t, "Interactive Suite")
}