Skip to content

Commit

Permalink
add activation test
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl>
  • Loading branch information
JorTurFer committed Sep 25, 2023
1 parent 9ab1a44 commit df34edd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/internals/scaling_modifiers/scaling_modifiers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ spec:
scalingModifiers:
formula: metrics_api + kw_trig
target: '2'
activationTarget: '2'
pollingInterval: 5
cooldownPeriod: 5
minReplicaCount: 0
Expand Down Expand Up @@ -238,6 +239,12 @@ func TestScalingModifiers(t *testing.T) {

func testFormula(t *testing.T, kc *kubernetes.Clientset, data templateData) {
t.Log("--- testFormula ---")

// formula simply adds 2 metrics together (0+2=2; activationTarget = 2 -> replicas should be 0)
data.MetricValue = 0
KubectlApplyWithTemplate(t, data, "updateMetricsTemplate", updateMetricsTemplate)
AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, namespace, 0, 60)

// formula simply adds 2 metrics together (3+2=5; target = 2 -> 5/2 replicas should be 3)
data.MetricValue = 3
KubectlApplyWithTemplate(t, data, "updateMetricsTemplate", updateMetricsTemplate)
Expand Down

0 comments on commit df34edd

Please sign in to comment.