Skip to content

Commit

Permalink
chore: Add more granular control to E2E test setup (#5595)
Browse files Browse the repository at this point in the history
Allow the test setup to skip the installation of KEDA and/or Kafka so
that tests can run even if they were installed via other methods, such
as OLM operators.

Signed-off-by: Joel Smith <joelsmith@redhat.com>
  • Loading branch information
joelsmith authored Mar 12, 2024
1 parent 0bcb2d3 commit a4c0d86
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ New deprecation(s):

### Other

- **General**: Allow E2E tests to be run against existing KEDA and/or Kafka installation ([#5595](https://github.com/kedacore/keda/pull/5595))
- **General**: Improve readability of utility function getParameterFromConfigV2 ([#5037](https://github.com/kedacore/keda/issues/5037))
- **General**: Introduce ENABLE_OPENTELEMETRY in deploying/testing process ([#5375](https://github.com/kedacore/keda/issues/5375)|[#5578](https://github.com/kedacore/keda/issues/5578))
- **General**: Migrate away from unmaintained golang/mock and use uber/gomock ([#5440](https://github.com/kedacore/keda/issues/5440))
Expand Down
2 changes: 2 additions & 0 deletions tests/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ var (
GcpIdentityTests = os.Getenv("GCP_RUN_IDENTITY_TESTS")
EnableOpentelemetry = os.Getenv("ENABLE_OPENTELEMETRY")
InstallCertManager = AwsIdentityTests == StringTrue || GcpIdentityTests == StringTrue
InstallKeda = os.Getenv("E2E_INSTALL_KEDA")
InstallKafka = os.Getenv("E2E_INSTALL_KAFKA")
)

var (
Expand Down
8 changes: 8 additions & 0 deletions tests/utils/cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
)

func TestRemoveKEDA(t *testing.T) {
// default to true
if InstallKeda == StringFalse {
t.Skip("skipping as requested -- KEDA not installed via these tests")
}
out, err := ExecuteCommandWithDir("make undeploy", "../..")
require.NoErrorf(t, err, "error removing KEDA - %s", err)

Expand Down Expand Up @@ -89,6 +93,10 @@ func TestRemoveAzureManagedPrometheusComponents(t *testing.T) {
}

func TestRemoveStrimzi(t *testing.T) {
// default to true
if InstallKafka == StringFalse {
t.Skip("skipping as requested -- Kafka not managed by E2E tests")
}
_, err := ExecuteCommand(fmt.Sprintf(`helm uninstall --namespace %s %s`,
StrimziNamespace,
StrimziChartName))
Expand Down
12 changes: 12 additions & 0 deletions tests/utils/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ func TestSetupOpentelemetryComponents(t *testing.T) {
}

func TestDeployKEDA(t *testing.T) {
// default to true
if InstallKeda == StringFalse {
t.Skip("skipping as requested -- KEDA assumed to be already installed")
}
KubeClient = GetKubernetesClient(t)
CreateNamespace(t, KubeClient, KEDANamespace)

Expand All @@ -229,6 +233,10 @@ func TestDeployKEDA(t *testing.T) {
}

func TestVerifyKEDA(t *testing.T) {
// default to true
if InstallKeda == StringFalse {
t.Skip("skipping as requested -- KEDA assumed to be already installed")
}
assert.True(t, WaitForDeploymentReplicaReadyCount(t, KubeClient, KEDAOperator, KEDANamespace, 1, 30, 6),
"replica count should be 1 after 3 minutes")
assert.True(t, WaitForDeploymentReplicaReadyCount(t, KubeClient, KEDAMetricsAPIServer, KEDANamespace, 1, 30, 6),
Expand Down Expand Up @@ -268,6 +276,10 @@ func TestSetupAadPodIdentityComponents(t *testing.T) {
}

func TestSetUpStrimzi(t *testing.T) {
// default to true
if InstallKafka == StringFalse {
t.Skip("skipping as requested -- Kafka assumed to be unneeded or already installed")
}
t.Log("--- installing kafka operator ---")
_, err := ExecuteCommand("helm repo add strimzi https://strimzi.io/charts/")
assert.NoErrorf(t, err, "cannot execute command - %s", err)
Expand Down

0 comments on commit a4c0d86

Please sign in to comment.