Run only of asubset of the integration tests in OpenShift CI

Rationale: All of the integration tests are already covered in GitHb CI
(using Kubernetes), and they tend to be a bit flaky on OpenShift.
This commit is contained in:
Armel Soro
2024-05-18 09:15:33 +02:00
parent 3bfebaa4e6
commit 2508cf7362
30 changed files with 61 additions and 58 deletions

View File

@@ -5,10 +5,11 @@ import (
)
const (
LabelNoCluster = "nocluster"
LabelUnauth = "unauth"
LabelPodman = "podman"
LabelServiceBinding = "servicebinding"
LabelNoCluster = "nocluster"
LabelUnauth = "unauth"
LabelPodman = "podman"
LabelServiceBinding = "servicebinding"
LabelSkipOnOpenShift = "skiponopenshift"
)
func NeedsCluster(labels []string) bool {

View File

@@ -11,7 +11,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo add binding command tests", Label(helper.LabelServiceBinding), func() {
var _ = Describe("odo add binding command tests", Label(helper.LabelServiceBinding), Label(helper.LabelSkipOnOpenShift), func() {
// TODO: Add integration tests for the following cases when SBO is not installed
// * servicebinding with envvars does not send `odo dev` in an infinite loop
// * `odo dev` deletes service binding secrets for SB that is not present locally

View File

@@ -15,7 +15,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo delete command tests", func() {
var _ = Describe("odo delete command tests", Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
var cmpName, deploymentName, serviceName string
var getDeployArgs, getSVCArgs []string

View File

@@ -13,7 +13,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo describe component command tests", func() {
var _ = Describe("odo describe component command tests", Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
var cmpName string

View File

@@ -12,7 +12,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo describe/list binding command tests", Label(helper.LabelServiceBinding), func() {
var _ = Describe("odo describe/list binding command tests", Label(helper.LabelServiceBinding), Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
// This is run before every Spec (It)

View File

@@ -17,7 +17,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo dev command with api server tests", func() {
var _ = Describe("odo dev command with api server tests", Label(helper.LabelSkipOnOpenShift), func() {
var cmpName string
var commonVar helper.CommonVar

View File

@@ -36,7 +36,7 @@ var _ = Describe("odo dev debug command tests", func() {
for _, podman := range []bool{false, true} {
podman := podman
When("a component is bootstrapped", func() {
When("a component is bootstrapped", Label(helper.LabelSkipOnOpenShift), func() {
BeforeEach(func() {
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-with-debugrun.yaml")).ShouldPass()
@@ -132,7 +132,7 @@ var _ = Describe("odo dev debug command tests", func() {
for _, podman := range []bool{false, true} {
podman := podman
When("creating nodejs component, doing odo dev and run command has dev.odo.push.path attribute", helper.LabelPodmanIf(podman, func() {
When("creating nodejs component, doing odo dev and run command has dev.odo.push.path attribute", Label(helper.LabelSkipOnOpenShift), helper.LabelPodmanIf(podman, func() {
var devSession helper.DevSession
var devStarted bool
BeforeEach(func() {
@@ -191,7 +191,7 @@ var _ = Describe("odo dev debug command tests", func() {
devfileHandlerCtx := devfileHandlerCtx
for _, podman := range []bool{false, true} {
podman := podman
When("a composite command is used as debug command - "+devfileHandlerCtx.name, helper.LabelPodmanIf(podman, func() {
When("a composite command is used as debug command - "+devfileHandlerCtx.name, Label(helper.LabelSkipOnOpenShift), helper.LabelPodmanIf(podman, func() {
var devfileCmpName string
var devSession helper.DevSession
@@ -264,7 +264,7 @@ var _ = Describe("odo dev debug command tests", func() {
}
}
When("a composite apply command is used as debug command", func() {
When("a composite apply command is used as debug command", Label(helper.LabelSkipOnOpenShift), func() {
deploymentNames := []string{"my-openshift-component", "my-k8s-component"}
var devSession helper.DevSession
@@ -350,7 +350,7 @@ var _ = Describe("odo dev debug command tests", func() {
devfileHandlerCtx := devfileHandlerCtx
for _, podman := range []bool{false, true} {
podman := podman
When("running build and debug commands as composite in different containers and a shared volume - "+devfileHandlerCtx.name, helper.LabelPodmanIf(podman, func() {
When("running build and debug commands as composite in different containers and a shared volume - "+devfileHandlerCtx.name, Label(helper.LabelSkipOnOpenShift), helper.LabelPodmanIf(podman, func() {
var devfileCmpName string
var devSession helper.DevSession
@@ -434,7 +434,7 @@ var _ = Describe("odo dev debug command tests", func() {
for _, podman := range []bool{false, true} {
podman := podman
When("a component without debug command is bootstrapped", helper.LabelPodmanIf(podman, func() {
When("a component without debug command is bootstrapped", Label(helper.LabelSkipOnOpenShift), helper.LabelPodmanIf(podman, func() {
BeforeEach(func() {
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context)
helper.Cmd("odo", "init", "--name", cmpName, "--devfile-path", helper.GetExamplePath("source", "devfiles", "nodejs", "devfile-without-debugrun.yaml")).ShouldPass()

View File

@@ -38,7 +38,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo dev command tests", func() {
var _ = Describe("odo dev command tests", Label(helper.LabelSkipOnOpenShift), func() {
var cmpName string
var commonVar helper.CommonVar

View File

@@ -15,7 +15,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo devfile build-images command tests", func() {
var _ = Describe("odo devfile build-images command tests", Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
var cmpName string

View File

@@ -382,7 +382,7 @@ ComponentSettings:
})
}
When("deploying a ServiceBinding k8s resource", Label(helper.LabelServiceBinding), func() {
When("deploying a ServiceBinding k8s resource", Label(helper.LabelServiceBinding), Label(helper.LabelSkipOnOpenShift), func() {
const serviceBindingName = "my-nodejs-app-cluster-sample" // hard-coded from devfile-deploy-with-SB.yaml
BeforeEach(func() {
skipLogin := os.Getenv("SKIP_SERVICE_BINDING_TESTS")

View File

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

View File

@@ -14,7 +14,7 @@ import (
. "github.com/onsi/gomega"
)
var _ = Describe("odo list with devfile", func() {
var _ = Describe("odo list with devfile", Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
// This is run before every Spec (It)

View File

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

View File

@@ -10,7 +10,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo list services tests", Label(helper.LabelServiceBinding), func() {
var _ = Describe("odo list services tests", Label(helper.LabelServiceBinding), Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
var randomProject string

View File

@@ -24,7 +24,7 @@ func getLogCommand(podman bool, otherArgs ...string) *helper.CmdWrapper {
return cmd
}
var _ = Describe("odo logs command tests", func() {
var _ = Describe("odo logs command tests", Label(helper.LabelSkipOnOpenShift), func() {
var componentName string
var commonVar helper.CommonVar

View File

@@ -15,7 +15,7 @@ import (
. "github.com/onsi/gomega"
)
var _ = Describe("odo create/delete/list/set namespace/project tests", func() {
var _ = Describe("odo create/delete/list/set namespace/project tests", Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
BeforeEach(func() {

View File

@@ -18,7 +18,7 @@ import (
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.LabelSkipOnOpenShift), func() {
// TODO: A neater way to provide odo path. Currently we assume odo and oc in $PATH already.
var commonVar helper.CommonVar

View File

@@ -11,7 +11,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo remove binding command tests", Label(helper.LabelServiceBinding), func() {
var _ = Describe("odo remove binding command tests", Label(helper.LabelServiceBinding), Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
var _ = BeforeEach(func() {

View File

@@ -10,7 +10,7 @@ import (
. "github.com/onsi/gomega"
)
var _ = Describe("odo run command tests", func() {
var _ = Describe("odo run command tests", Label(helper.LabelSkipOnOpenShift), func() {
var cmpName string
var commonVar helper.CommonVar

View File

@@ -7,7 +7,7 @@ import (
"github.com/redhat-developer/odo/tests/helper"
)
var _ = Describe("odo generic", func() {
var _ = Describe("odo generic", Label(helper.LabelSkipOnOpenShift), func() {
// TODO: A neater way to provide odo path. Currently we assume \
// odo and oc in $PATH already
var oc helper.OcRunner

View File

@@ -13,7 +13,7 @@ import (
. "github.com/onsi/gomega"
)
var _ = Describe("odo add binding interactive command tests", Label(helper.LabelServiceBinding), func() {
var _ = Describe("odo add binding interactive command tests", Label(helper.LabelServiceBinding), Label(helper.LabelSkipOnOpenShift), func() {
var commonVar helper.CommonVar
var serviceName string

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,7 @@ package integration
import (
"os"
"strings"
"time"
. "github.com/onsi/ginkgo/v2"
@@ -46,6 +47,9 @@ var _ = Describe("odo login and logout command tests", func() {
Context("when running login tests", func() {
It("should successful with correct credentials and fails with incorrect token", func() {
if strings.ToLower(os.Getenv("CI")) != "openshift" {
Skip("Skipping if not running on OpenShift. Set CI environment variable to openshift.")
}
// skip if requested
skipLogin := os.Getenv("SKIP_USER_LOGIN_TESTS")
if skipLogin == "true" {

View File

@@ -11,6 +11,7 @@ import (
. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/pkg/odo/cli/plugins"
"github.com/redhat-developer/odo/tests/helper"
)
var sampleScript = []byte(`
@@ -18,7 +19,7 @@ var sampleScript = []byte(`
echo 'hello'
`)
var _ = Describe("odo plugin functionality", func() {
var _ = Describe("odo plugin functionality", Label(helper.LabelSkipOnOpenShift), func() {
var tempDir string
var origPath = os.Getenv("PATH")
var handler plugins.PluginHandler