From afa6c780e10fdd6c60e53535add3f89a8df2c87e Mon Sep 17 00:00:00 2001 From: Ritikaa96 Date: Thu, 6 Jan 2022 16:21:03 +0530 Subject: [PATCH] adding e2e test for cpu scaler: updating the trigger-job , Updating changelog Signed-off-by: Ritikaa96 --- CHANGELOG.md | 2 +- tests/scalers/cpu.test.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ebb669df9c..8eebf23b9d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ - **PostgreSQL Scaler:** Assign PostgreSQL `userName` to correct attribute ([#2432](https://github.com/kedacore/keda/pull/2432))|([#2433](https://github.com/kedacore/keda/pull/2433)) - **Kafka Scaler:** concurrently query brokers for consumer and producer offsets ([#2405](https://github.com/kedacore/keda/pull/2405)) - **External Scaler:** fix wrong calculation of retry backoff duration ([#2416](https://github.com/kedacore/keda/pull/2416)) - +- **CPU Scaler:** Adding e2e test for the cpu scaler ([#2441](https://github.com/kedacore/keda/pull/2441)) ### Breaking Changes - TODO ([#XXX](https://github.com/kedacore/keda/pull/XXX)) diff --git a/tests/scalers/cpu.test.ts b/tests/scalers/cpu.test.ts index 8a1f816a358..219978671ea 100644 --- a/tests/scalers/cpu.test.ts +++ b/tests/scalers/cpu.test.ts @@ -40,13 +40,12 @@ test.serial(`Creating Job should work`, async t => { }) test.serial(`Deployment should scale to 5 after 3 minutes`, async t => { - const maxReplicaCount = '5' // check replicacount on constant triggering : t.true(await waitForDeploymentReplicaCount(5, 'php-apache', testNamespace, 18, 10000), 'Replica count should be 5 after 180 seconds') }) -test.serial(`Deployment should scale back to 1 after 10 minutes`, async t => { +test.serial(`Deployment should scale back to 1 after 8 minutes`, async t => { // check for the scale down : - t.true(await waitForDeploymentReplicaCount(1, 'php-apache', testNamespace, 60, 10000), 'Replica count should be 1 after 10 minutes') + t.true(await waitForDeploymentReplicaCount(1, 'php-apache', testNamespace, 48, 10000), 'Replica count should be 1 after 8 minutes') }) test.after.always.cb('clean up workload test related deployments', t => { @@ -117,14 +116,15 @@ const triggerJob = `apiVersion: batch/v1 kind: Job metadata: name: trigger-job + namespace: cpu-test spec: template: spec: containers: - - image: jordi/ab + - image: busybox name: test command: ["/bin/sh"] - args: ["-c", "for i in $(seq 1 180);do echo $i;ab -c 5 -n 1000 -v 2 http://php-apache.cpu-test.svc/;sleep 1;done"] + args: ["-c", "for i in $(seq 1 180);do wget -q -O- http://php-apache.cpu-test.svc/;sleep 0.1;done"] restartPolicy: Never - activeDeadlineSeconds: 300 - backoffLimit: 2` + activeDeadlineSeconds: 280 + backoffLimit: 3`