diff --git a/tests/scalers/kafka.test.ts b/tests/scalers/kafka.test.ts index 986d7863a1f..e96f642f5de 100644 --- a/tests/scalers/kafka.test.ts +++ b/tests/scalers/kafka.test.ts @@ -194,7 +194,7 @@ test.serial('Latest Scale object should scale with new messages', t => { } }) -test.serial('cleanup after latest policy test', t=> { +test.serial('Cleanup after latest policy test', t=> { t.is( 0, sh.exec(`kubectl delete -f ${scaledObjectLatestYamlFile.name} --namespace ${defaultNamespace}`).code, @@ -233,16 +233,18 @@ test.serial('Applying ScaledObject with multiple topics should scale up pods', t // produce a single msg to the default topic should not scale sh.exec(`kubectl exec --namespace ${defaultNamespace} ${defaultKafkaClient} -- sh -exc 'echo "{\"text\": \"foo\"}" | kafka-console-producer --broker-list ${defaultCluster}-kafka-bootstrap.${defaultNamespace}:9092 --topic ${defaultTopic}'`) - sh.exec(`sleep 5s`) + sh.exec(`sleep 20s`) + waitForReplicaCount(0, commandToCheckReplicas) t.is('0', sh.exec(commandToCheckReplicas).stdout, 'Replica count should be 0.') // produce one more msg to the different topic should trigger scale sh.exec(`kubectl exec --namespace ${defaultNamespace} ${defaultKafkaClient} -- sh -exc 'echo "{\"text\": \"foo\"}" | kafka-console-producer --broker-list ${defaultCluster}-kafka-bootstrap.${defaultNamespace}:9092 --topic ${defaultTopic2}'`) - sh.exec(`sleep 10s`) + sh.exec(`sleep 20s`) + waitForReplicaCount(1, commandToCheckReplicas) t.is('1', sh.exec(commandToCheckReplicas).stdout, 'Replica count should be 1.') }) -test.serial('cleanup after multiple topics test', t=> { +test.serial('Cleanup after multiple topics test', t=> { t.is( 0, sh.exec(`kubectl delete -f ${scaledObjectMultipleTopicsYamlFile.name} --namespace ${defaultNamespace}`).code,