Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/templates/kuttl/logging/05-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ commands:
python /tmp/test_log_aggregation.py -n $NAMESPACE
- script: >-
kubectl exec --namespace=$NAMESPACE opa-test-runner-0 --
sh /tmp/test_log_aggregation.sh
/tmp/test_log_aggregation.sh
10 changes: 9 additions & 1 deletion tests/templates/kuttl/logging/test_log_aggregation.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/usr/bin/env bash

DECISION_LOGS=$(kubectl logs service/test-opa-server -c opa | grep "decision_id");
# we should distinguish between cases where the variable is not set
# if the service or container is not found (which we don't want), and where
# grep does not find anything (which is what we *do* want).

set -Eeuo pipefail

# do not mask kubectl errors, but the right-hand group must always be true
# so the test does not fail on the grep
DECISION_LOGS=$(kubectl logs service/test-opa-server -c opa | { grep "decision_id" || true; })

if [ -n "$DECISION_LOGS" ];
then
Expand Down
Loading