Skip to content

Managed to make core-14 failed silently #27

@jd-imi

Description

@jd-imi

In core-14, I forgot to update the port from core-13, so, 8013 was left instead of 8014.
check.sh didn't gave a "Failed" message but the check in dockerlings didn't work (it was because check.sh returned with a non-null value)

The two last lines of the log I had:

--> Accessing web app to increment counter to 1...
--> Shutting down Docker Compose project...

There was no "Failed" message because the curl command returned with a non-null value (7 in this case), so the script exits immediately.

I get a "Failed" with this (and the return code is still non-zero):

--- a/exercises/core-14/check.sh
+++ b/exercises/core-14/check.sh
@@ -55,7 +55,9 @@ fi
 
 log_info "Performing persistence test..."
 log_info "Accessing web app to increment counter to 1..."
+set +euo pipefail
 RESPONSE_1=$(curl -s http://localhost:$HOST_PORT)
+set -euo pipefail
 if ! echo "$RESPONSE_1" | grep -q "visited 1 times"; then
   log_fail "The web app did not return the expected first visit message. Response was: '$RESPONSE_1'" "Is the web app connected to Redis? Check the logs with 'docker compose logs web'."
 fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions