octopot / stub

🫥 Stub domains for redirects.
https://stub.octolab.org/
MIT License
0 stars 0 forks source link

ci/cd: add integration tests #10

Open kamilsk opened 11 months ago

kamilsk commented 11 months ago

Motivation: healthcheck.

PoC

#!/bin/bash

# URL to check
url="http://example.com"

# Expected redirect location
expected_redirect="http://example.com/new-location"

# Send a request and extract the actual redirect location
actual_redirect=$(curl -Ls -o /dev/null -w %{url_effective} "$url")

# Compare the actual redirect location with the expected one
if [ "$actual_redirect" = "$expected_redirect" ]; then
    echo "Redirect is correct: $actual_redirect"
else
    echo "Redirect is incorrect: Expected $expected_redirect, but got $actual_redirect"
fi