From 5c209f42baeca6c2d7c7bb401db00b7abf77db83 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Sat, 23 Jul 2022 17:20:41 +0200 Subject: [PATCH] add e2e test for redis-lists* activation Signed-off-by: Jorge Turrado --- .../redis_cluster_lists/redis_cluster_lists_test.go | 11 +++++++++++ .../redis_sentinel_lists/redis_sentinel_lists_test.go | 11 +++++++++++ .../redis_standalone_lists_test.go | 11 +++++++++++ .../redis_standalone_streams_test.go | 10 ---------- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/tests/scalers_go/redis_cluster_lists/redis_cluster_lists_test.go b/tests/scalers_go/redis_cluster_lists/redis_cluster_lists_test.go index 1ae65813b0f..743848173e2 100644 --- a/tests/scalers_go/redis_cluster_lists/redis_cluster_lists_test.go +++ b/tests/scalers_go/redis_cluster_lists/redis_cluster_lists_test.go @@ -133,6 +133,7 @@ spec: addressesFromEnv: REDIS_ADDRESSES listName: {{.RedisList}} listLength: "5" + activationListLength: "10" authenticationRef: name: {{.TriggerAuthenticationName}} ` @@ -177,6 +178,7 @@ func TestScaler(t *testing.T) { data, templates := getTemplateData() CreateKubernetesResources(t, kc, testNamespace, data, templates) + testActivation(t, kc, data) testScaleUp(t, kc, data) testScaleDown(t, kc) @@ -185,6 +187,15 @@ func TestScaler(t *testing.T) { DeleteKubernetesResources(t, kc, testNamespace, data, templates) } +func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { + t.Log("--- testing activation ---") + templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} + data.ItemsToWrite = 5 + KubectlApplyMultipleWithTemplate(t, data, templateTriggerJob) + + AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60) +} + func testScaleUp(t *testing.T, kc *kubernetes.Clientset, data templateData) { t.Log("--- testing scale up ---") templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} diff --git a/tests/scalers_go/redis_sentinel_lists/redis_sentinel_lists_test.go b/tests/scalers_go/redis_sentinel_lists/redis_sentinel_lists_test.go index 684afebc613..c890f535068 100644 --- a/tests/scalers_go/redis_sentinel_lists/redis_sentinel_lists_test.go +++ b/tests/scalers_go/redis_sentinel_lists/redis_sentinel_lists_test.go @@ -137,6 +137,7 @@ spec: listName: {{.RedisList}} sentinelMaster: mymaster listLength: "5" + activationListLength: "10" authenticationRef: name: {{.TriggerAuthenticationName}} ` @@ -185,6 +186,7 @@ func TestScaler(t *testing.T) { data, templates := getTemplateData() CreateKubernetesResources(t, kc, testNamespace, data, templates) + testActivation(t, kc, data) testScaleUp(t, kc, data) testScaleDown(t, kc) @@ -193,6 +195,15 @@ func TestScaler(t *testing.T) { DeleteKubernetesResources(t, kc, testNamespace, data, templates) } +func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { + t.Log("--- testing activation ---") + templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} + data.ItemsToWrite = 5 + KubectlApplyMultipleWithTemplate(t, data, templateTriggerJob) + + AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60) +} + func testScaleUp(t *testing.T, kc *kubernetes.Clientset, data templateData) { t.Log("--- testing scale up ---") templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} diff --git a/tests/scalers_go/redis_standalone_lists/redis_standalone_lists_test.go b/tests/scalers_go/redis_standalone_lists/redis_standalone_lists_test.go index b2764623d15..74173103da7 100644 --- a/tests/scalers_go/redis_standalone_lists/redis_standalone_lists_test.go +++ b/tests/scalers_go/redis_standalone_lists/redis_standalone_lists_test.go @@ -130,6 +130,7 @@ spec: portFromEnv: REDIS_PORT listName: {{.RedisList}} listLength: "5" + activationListLength: "10" authenticationRef: name: {{.TriggerAuthenticationName}} ` @@ -173,6 +174,7 @@ func TestScaler(t *testing.T) { data, templates := getTemplateData() CreateKubernetesResources(t, kc, testNamespace, data, templates) + testActivation(t, kc, data) testScaleUp(t, kc, data) testScaleDown(t, kc) @@ -181,6 +183,15 @@ func TestScaler(t *testing.T) { DeleteKubernetesResources(t, kc, testNamespace, data, templates) } +func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { + t.Log("--- testing activation ---") + templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} + data.ItemsToWrite = 5 + KubectlApplyMultipleWithTemplate(t, data, templateTriggerJob) + + AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60) +} + func testScaleUp(t *testing.T, kc *kubernetes.Clientset, data templateData) { t.Log("--- testing scale up ---") templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} diff --git a/tests/scalers_go/redis_standalone_streams/redis_standalone_streams_test.go b/tests/scalers_go/redis_standalone_streams/redis_standalone_streams_test.go index d22b48b364b..234b0b9e752 100644 --- a/tests/scalers_go/redis_standalone_streams/redis_standalone_streams_test.go +++ b/tests/scalers_go/redis_standalone_streams/redis_standalone_streams_test.go @@ -176,7 +176,6 @@ func TestScaler(t *testing.T) { assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 1, 60, 3), "replica count should be %d after 3 minutes", 1) - // testActivation(t, kc, data) testScaleUp(t, kc, data) testScaleDown(t, kc) @@ -185,15 +184,6 @@ func TestScaler(t *testing.T) { DeleteKubernetesResources(t, kc, testNamespace, data, templates) } -func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) { - t.Log("--- testing activation ---") - templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate} - data.ItemsToWrite = 5 - KubectlApplyMultipleWithTemplate(t, data, templateTriggerJob) - - AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60) -} - func testScaleUp(t *testing.T, kc *kubernetes.Clientset, data templateData) { t.Log("--- testing scale up ---") templateTriggerJob := templateValues{"insertJobTemplate": insertJobTemplate}