Skip to content

Commit

Permalink
remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld committed Jan 22, 2025
1 parent 5f4359c commit 76e5f87
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions bin/verify_kafka_warnings
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#!/bin/bash

# Checks Kafka logs for warning patterns that indicate incorrect Karafka usage
# These warnings should never occur as Karafka should prevent such operations
# Checks Kafka logs for unsupported warning patterns
# Only specified warnings are allowed, all others should trigger failure

patterns=(
"as well as transactional"
allowed_patterns=(
"Performing controller activation"
"registered with feature metadata.version"
)

found=0
for pattern in "${patterns[@]}"; do
output=$(docker logs kafka | grep WARN | grep "$pattern")
if [ -n "$output" ]; then
echo "Found warning pattern: $pattern"
echo "$output"
found=1
# Get all warnings
warnings=$(docker logs kafka | grep WARN)
exit_code=0

while IFS= read -r line; do
allowed=0
for pattern in "${allowed_patterns[@]}"; do
if echo "$line" | grep -q "$pattern"; then
allowed=1
break
fi
done

if [ $allowed -eq 0 ]; then
echo "Unexpected warning found:"
echo "$line"
exit_code=1
fi
done
done <<< "$warnings"

exit $found
exit $exit_code

0 comments on commit 76e5f87

Please sign in to comment.