From e8566e3c164a1b21c99ed6a5155f7fe6a08df3cb Mon Sep 17 00:00:00 2001 From: Gustav Westling Date: Mon, 25 Nov 2024 13:18:27 +0100 Subject: [PATCH] Add tests for MinReplicasDeployment --- score/deployment_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/score/deployment_test.go b/score/deployment_test.go index e2802e3..8721498 100644 --- a/score/deployment_test.go +++ b/score/deployment_test.go @@ -1,9 +1,10 @@ package score import ( - "github.com/zegl/kube-score/config" "testing" + "github.com/zegl/kube-score/config" + "github.com/stretchr/testify/assert" ks "github.com/zegl/kube-score/domain" "github.com/zegl/kube-score/scorecard" @@ -55,6 +56,20 @@ func TestServiceTargetsDeploymentReplicasNok(t *testing.T) { }, "Deployment Replicas", scorecard.GradeWarning) } +func TestServiceTargetsDeploymentReplicasNok1(t *testing.T) { + t.Parallel() + testExpectedScoreWithConfig(t, []ks.NamedReader{testFile("service-target-deployment-replica-1.yaml")}, nil, &config.RunConfiguration{ + MinReplicasDeployment: 1, + }, "Deployment Replicas", scorecard.GradeAllOK) +} + +func TestServiceTargetsDeploymentReplicasNok5(t *testing.T) { + t.Parallel() + testExpectedScoreWithConfig(t, []ks.NamedReader{testFile("service-target-deployment-replica-1.yaml")}, nil, &config.RunConfiguration{ + MinReplicasDeployment: 5, + }, "Deployment Replicas", scorecard.GradeWarning) +} + func TestHPATargetsDeployment(t *testing.T) { t.Parallel() assert.True(t, wasSkipped(t,