Skip to content

Commit

Permalink
Add suggested changes
Browse files Browse the repository at this point in the history
Signed-off-by: FlamingSaint <raghuramkannan400@gmail.com>
  • Loading branch information
FlamingSaint committed Jul 16, 2024
1 parent 08c1cc3 commit 6a49726
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/spm-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,22 @@ validate_service_metrics() {
echo "Metric datapoints found for service '$service': " "${metric_points[@]}"
# Check that atleast some values are non-zero after the threshold
local non_zero_count=0
local threshold=3
local expected_non_zero_count=3
local zero_count=0
local expected_max_zero_count=3
for value in "${metric_points[@]}"; do
if [[ $(echo "$value > 0.0" | bc) == "1" ]]; then
non_zero_count=$((non_zero_count + 1))
else
threshold=$((threshold - 1))
zero_count=$((zero_count + 1))
fi

if [[ $threshold -eq 0 ]]; then
echo "❌ ERROR: Zero values crossing threshold limit not expected (Threshold limit - '$threshold')"
if [[ $zero_count -gt $expected_max_zero_count ]]; then
echo "❌ ERROR: Zero values crossing threshold limit not expected (Threshold limit - '$expected_max_zero_count')"
return 1
fi
done
if [ $non_zero_count -lt 3 ]; then
if [ $non_zero_count -lt $expected_non_zero_count ]; then
echo "⏳ Expecting at least 3 non-zero data points"
return 1
fi
Expand Down

0 comments on commit 6a49726

Please sign in to comment.