Define label for integration tests not needing cluster (#6242)

This commit is contained in:
Philippe Martin
2022-10-31 23:16:24 +01:00
committed by GitHub
parent 233c817c50
commit 2dab7fbda9
12 changed files with 46 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ export SKIP_USER_LOGIN_TESTS=true
export DEVFILE_PROXY="$(kubectl get svc -n devfile-proxy nginx -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' || true)" export DEVFILE_PROXY="$(kubectl get svc -n devfile-proxy nginx -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' || true)"
echo Using Devfile proxy: ${DEVFILE_PROXY} echo Using Devfile proxy: ${DEVFILE_PROXY}
make install make install
make test-integration make test-integration-cluster
make test-e2e make test-e2e
) |& tee "/tmp/${LOGFILE}" ) |& tee "/tmp/${LOGFILE}"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
LOGFILE="pr-${GIT_PR_NUMBER}-nocluster-tests-${BUILD_NUMBER}"
source .ibm/pipelines/functions.sh
ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r "${IBM_REGION}"
(
set -e
make install
make test-integration-no-cluster
) |& tee "/tmp/${LOGFILE}"
RESULT=${PIPESTATUS[0]}
save_logs "${LOGFILE}" "NoCluster Tests" ${RESULT}
exit ${RESULT}

View File

@@ -16,7 +16,7 @@ cleanup_namespaces
export DEVFILE_PROXY="$(kubectl get svc -n devfile-proxy nginx -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' || true)" export DEVFILE_PROXY="$(kubectl get svc -n devfile-proxy nginx -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' || true)"
echo Using Devfile proxy: ${DEVFILE_PROXY} echo Using Devfile proxy: ${DEVFILE_PROXY}
make install make install
make test-integration make test-integration-cluster
make test-e2e make test-e2e
) |& tee "/tmp/${LOGFILE}" ) |& tee "/tmp/${LOGFILE}"

View File

@@ -80,7 +80,7 @@ function Run-Test {
Shout "Create Binary" Shout "Create Binary"
make install make install
Shout "Running test" Shout "Running test"
make test-integration | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE make test-integration-cluster | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE Check-ExitCode $LASTEXITCODE
make test-e2e | 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 Check-ExitCode $LASTEXITCODE

View File

@@ -49,8 +49,8 @@ export ARTIFACT_DIR ?= .
GINKGO_FLAGS_ALL = $(GINKGO_TEST_ARGS) --randomize-all --slow-spec-threshold=$(SLOW_SPEC_THRESHOLD) -timeout $(TIMEOUT) --no-color GINKGO_FLAGS_ALL = $(GINKGO_TEST_ARGS) --randomize-all --slow-spec-threshold=$(SLOW_SPEC_THRESHOLD) -timeout $(TIMEOUT) --no-color
# Flags for tests that must not be run in parallel. # Flags to run one test per core.
GINKGO_FLAGS_SERIAL = $(GINKGO_FLAGS_ALL) -nodes=1 GINKGO_FLAGS_AUTO = $(GINKGO_FLAGS_ALL) -p
# Flags for tests that may be run in parallel # Flags for tests that may be run in parallel
GINKGO_FLAGS=$(GINKGO_FLAGS_ALL) -nodes=$(TEST_EXEC_NODES) GINKGO_FLAGS=$(GINKGO_FLAGS_ALL) -nodes=$(TEST_EXEC_NODES)
# GolangCi version for unit-validate test # GolangCi version for unit-validate test
@@ -188,9 +188,16 @@ vendor-update: ## Update vendoring
openshiftci-presubmit-unittests: openshiftci-presubmit-unittests:
./scripts/openshiftci-presubmit-unittests.sh ./scripts/openshiftci-presubmit-unittests.sh
.PHONY: test-integration-cluster
test-integration-cluster:
$(RUN_GINKGO) $(GINKGO_FLAGS) --label-filter="!nocluster" tests/integration
.PHONY: test-integration-no-cluster
test-integration-no-cluster:
$(RUN_GINKGO) $(GINKGO_FLAGS_AUTO) --label-filter=nocluster tests/integration
.PHONY: test-integration .PHONY: test-integration
test-integration: test-integration: test-integration-no-cluster test-integration-cluster
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration
.PHONY: test-e2e .PHONY: test-e2e
test-e2e: test-e2e:

View File

@@ -193,10 +193,10 @@ func CommonBeforeEach(setupCluster bool) CommonVar {
commonVar := CommonVar{} commonVar := CommonVar{}
commonVar.Context = CreateNewContext() commonVar.Context = CreateNewContext()
commonVar.ConfigDir = CreateNewContext() commonVar.ConfigDir = CreateNewContext()
commonVar.OriginalKubeconfig = os.Getenv("KUBECONFIG")
commonVar.CliRunner = GetCliRunner() commonVar.CliRunner = GetCliRunner()
LocalKubeconfigSet(commonVar.ConfigDir) commonVar.OriginalKubeconfig = os.Getenv("KUBECONFIG")
if setupCluster { if setupCluster {
LocalKubeconfigSet(commonVar.ConfigDir)
commonVar.Project = commonVar.CliRunner.CreateAndSetRandNamespaceProject() commonVar.Project = commonVar.CliRunner.CreateAndSetRandNamespaceProject()
} }
commonVar.OriginalWorkingDirectory = Getwd() commonVar.OriginalWorkingDirectory = Getwd()

5
tests/helper/labels.go Normal file
View File

@@ -0,0 +1,5 @@
package helper
const (
LabelNoCluster = "nocluster"
)

View File

@@ -9,7 +9,7 @@ import (
"github.com/redhat-developer/odo/tests/helper" "github.com/redhat-developer/odo/tests/helper"
) )
var _ = Describe("odo analyze command tests", func() { var _ = Describe("odo analyze command tests", Label(helper.LabelNoCluster), func() {
var commonVar helper.CommonVar var commonVar helper.CommonVar
// This is run before every Spec (It) // This is run before every Spec (It)

View File

@@ -18,7 +18,7 @@ import (
"github.com/redhat-developer/odo/tests/helper" "github.com/redhat-developer/odo/tests/helper"
) )
var _ = Describe("odo devfile init command tests", func() { var _ = Describe("odo devfile init command tests", Label(helper.LabelNoCluster), func() {
var commonVar helper.CommonVar var commonVar helper.CommonVar

View File

@@ -9,7 +9,7 @@ import (
"github.com/redhat-developer/odo/tests/helper" "github.com/redhat-developer/odo/tests/helper"
) )
var _ = Describe("odo devfile registry command tests", func() { var _ = Describe("odo devfile registry command tests", Label(helper.LabelNoCluster), func() {
const registryName string = "RegistryName" const registryName string = "RegistryName"
// Use staging OCI-based registry for tests to avoid overload // Use staging OCI-based registry for tests to avoid overload

View File

@@ -13,7 +13,7 @@ import (
const promptMessageSubString = "Help odo improve by allowing it to collect usage data." const promptMessageSubString = "Help odo improve by allowing it to collect usage data."
var _ = Describe("odo preference and config command tests", func() { var _ = Describe("odo preference and config command tests", Label(helper.LabelNoCluster), func() {
// TODO: A neater way to provide odo path. Currently we assume odo and oc in $PATH already. // TODO: A neater way to provide odo path. Currently we assume odo and oc in $PATH already.
var commonVar helper.CommonVar var commonVar helper.CommonVar

View File

@@ -17,7 +17,7 @@ import (
"github.com/redhat-developer/odo/tests/helper" "github.com/redhat-developer/odo/tests/helper"
) )
var _ = Describe("odo init interactive command tests", func() { var _ = Describe("odo init interactive command tests", Label(helper.LabelNoCluster), func() {
var commonVar helper.CommonVar var commonVar helper.CommonVar