Skip to content

Commit

Permalink
fixing the smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
ash0ne committed Apr 7, 2024
1 parent 23abd1d commit d6c6ba7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions smoke_test.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

response_unauthorized=$(curl -Iv http://localhost:5000 2>&1)
# Send a request without authentication
response_unauthorized=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3040)

# Check if response contains HTTP/1.1 401 Unauthorized
if [[ "$response_unauthorized" == *"HTTP/1.1 401 Unauthorized"* ]]; then
# Check if response status code is 401 Unauthorized
if [[ "$response_unauthorized" == "401" ]]; then
echo "Test passed: Response is 401 Unauthorized"
else
echo "Test failed: Response is not 401 Unauthorized"
exit 1
fi

response_authorized=$(curl -Iv -u test-user:test-password http://localhost:5000 2>&1)
# Send a request with basic authentication
response_authorized=$(curl -s -o /dev/null -w "%{http_code}" -u user:test-password http://localhost:3040)

# Check if response contains HTTP/1.1 200 OK
if [[ "$response_authorized" == *"HTTP/1.1 200 OK"* ]]; then
# Check if response status code is 200 OK
if [[ "$response_authorized" == "200" ]]; then
echo "Test passed: Response is 200 OK when passing basic authentication"
exit 0
else
Expand Down

0 comments on commit d6c6ba7

Please sign in to comment.