Skip to content

Commit e37f7fd

Browse files
test(evidence): cover failed DGD query
Exercise the fail-closed operator path separately from the successful zero-row SKIP case and assert the collector emits exactly one FAIL verdict. Signed-off-by: JS van Dijk <267467744+hogeheer499-commits@users.noreply.github.com>
1 parent c71c675 commit e37f7fd

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

pkg/evidence/cncf/result_propagation_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ case "${mode}" in
8080
}
8181
SECTION="operator"
8282
;;
83+
operator-dynamo-query-failed)
84+
# Dynamo operator is installed but the DGD query fails: preserve the
85+
# fail-closed behavior instead of treating the failed query as zero rows.
86+
kubectl() {
87+
if [ "${1:-}" = "cluster-info" ]; then
88+
return 0
89+
fi
90+
case " $* " in
91+
*"dynamo-platform-dynamo-operator-controller-manager"*) echo "dynamo-operator 1/1" ;;
92+
*" dynamographdeployments "*) return 1 ;;
93+
esac
94+
return 0
95+
}
96+
SECTION="operator"
97+
;;
8398
autoscaler-absent)
8499
SECTION="cluster-autoscaling"
85100
;;
@@ -233,6 +248,14 @@ func TestEvidenceResultPropagatesThroughCollector(t *testing.T) {
233248
wantStatus: "SKIP",
234249
singleVerdictFile: "robust-operator.md",
235250
},
251+
{
252+
name: "operator DGD query failure fails closed",
253+
mode: "operator-dynamo-query-failed",
254+
displayName: "Robust AI Operator",
255+
wantStatus: "FAIL",
256+
singleVerdictFile: "robust-operator.md",
257+
wantErr: true,
258+
},
236259
{
237260
name: "absent autoscaler emits explicit skip",
238261
mode: "autoscaler-absent",

0 commit comments

Comments
 (0)