-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |