Skip to content

Commit

Permalink
Place e2e-bats test in expected order (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
wissamir committed Oct 19, 2024
1 parent 61765af commit 73ec2c7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions e2etests/bats-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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 -
}

0 comments on commit 73ec2c7

Please sign in to comment.