diff --git a/e2etests/bats-tests.sh b/e2etests/bats-tests.sh index a224e3c40..f0a2d8ca6 100755 --- a/e2etests/bats-tests.sh +++ b/e2etests/bats-tests.sh @@ -648,6 +648,20 @@ get_value_from() { [[ "${count}" == "3" ]] } +@test "pdb-unhealthy-pod-eviction-policy" { + + tmp="tests/checks/pdb-unhealthy-pod-eviction-policy.yaml" + cmd="${KUBE_LINTER_BIN} lint --include pdb-unhealthy-pod-eviction-policy --do-not-auto-add-defaults --format json ${tmp}" + run ${cmd} + + message1=$(get_value_from "${lines[0]}" '.Reports[0].Object.K8sObject.GroupVersionKind.Kind + ": " + .Reports[0].Diagnostic.Message') + + [[ "${message1}" == "PodDisruptionBudget: unhealthyPodEvictionPolicy is not explicitly set" ]] + count=$(get_value_from "${lines[0]}" '.Reports | length') + [[ "${count}" == "1" ]] + +} + @test "privilege-escalation-container" { tmp="tests/checks/privilege-escalation-container.yml" cmd="${KUBE_LINTER_BIN} lint --include privilege-escalation-container --do-not-auto-add-defaults --format json ${tmp}" @@ -1000,20 +1014,6 @@ get_value_from() { [ "$status" -eq 0 ] } -@test "pdb-unhealthy-pod-eviction-policy" { - - tmp="tests/checks/pdb-unhealthy-pod-eviction-policy.yaml" - cmd="${KUBE_LINTER_BIN} lint --include pdb-unhealthy-pod-eviction-policy --do-not-auto-add-defaults --format json ${tmp}" - run ${cmd} - - message1=$(get_value_from "${lines[0]}" '.Reports[0].Object.K8sObject.GroupVersionKind.Kind + ": " + .Reports[0].Diagnostic.Message') - - [[ "${message1}" == "PodDisruptionBudget: unhealthyPodEvictionPolicy is not explicitly set" ]] - count=$(get_value_from "${lines[0]}" '.Reports | length') - [[ "${count}" == "1" ]] - -} - @test "flag-read-from-stdin" { echo "---" | ${KUBE_LINTER_BIN} lint - }