Skip to content

Commit

Permalink
tests(parallel_cgi): fix tests not failing if test if failing
Browse files Browse the repository at this point in the history
We had to change the way the error is checked - we write the error in a file cause for the async nature of the operation the error variable was not correctly read
  • Loading branch information
552020 committed May 23, 2024
1 parent 6cbb399 commit 803fb7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions tests/parallel_cgi/duration_ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ is_error=false

URL="http://127.0.0.1:8080/cgi-bin/duration_ts.cgi"
temp_file=$(mktemp)
error_file=$(mktemp)

# Send requests and collect the times
for i in {1..3}; do
Expand All @@ -18,7 +19,8 @@ for i in {1..3}; do
echo "$end_time Request $i: End time = $end_time" >> "$temp_file"
else
echo "Failed to parse timestamps from request $i response"
is_error=true
echo "error" >> "$error_file"

fi
} &
done
Expand All @@ -34,8 +36,11 @@ done
# Clean up temporary file
rm "$temp_file"

if [ "$is_error" = true ]; then
# Check if there were any errors
if [ -s "$error_file" ]; then
rm "$error_file"
exit 1
fi

rm "$error_file"
exit 0
2 changes: 1 addition & 1 deletion var/www.development_site/cgi-bin/duration_ts.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import time
from datetime import datetime

# Define the duration of the counter in seconds
duration = 2
duration = 8

# Print the HTTP header
print("Content-Type: text/html")
Expand Down

0 comments on commit 803fb7f

Please sign in to comment.