fix: restore smoke-init CI pipeline using mock Forgejo (#124)
This commit is contained in:
parent
105070e379
commit
7190abb4e1
3 changed files with 4 additions and 6 deletions
|
|
@ -32,7 +32,7 @@ steps:
|
||||||
image: python:3-alpine
|
image: python:3-alpine
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache bash curl jq git coreutils
|
- apk add --no-cache bash curl jq git coreutils
|
||||||
- MOCK_FORGE_PORT=3001 python3 tests/mock-forgejo.py &
|
- MOCK_FORGE_PORT=3001 python3 tests/mock-forgejo.py > /tmp/mock.log 2>&1 &
|
||||||
# Wait for mock to be ready
|
# Wait for mock to be ready
|
||||||
- for i in $(seq 1 30); do curl -sf http://localhost:3001/api/v1/version >/dev/null 2>&1 && break || sleep 1; done
|
- for i in $(seq 1 30); do curl -sf http://localhost:3001/api/v1/version >/dev/null 2>&1 && break || sleep 1; done
|
||||||
- SMOKE_FORGE_URL=http://localhost:3001 FORGE_URL=http://localhost:3001 bash tests/smoke-init.sh
|
- SMOKE_FORGE_URL=http://localhost:3001 FORGE_URL=http://localhost:3001 bash tests/smoke-init.sh
|
||||||
|
|
|
||||||
|
|
@ -695,6 +695,7 @@ class ForgejoHandler(BaseHTTPRequestHandler):
|
||||||
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
|
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
|
||||||
"""Threaded HTTP server for handling concurrent requests."""
|
"""Threaded HTTP server for handling concurrent requests."""
|
||||||
daemon_threads = True
|
daemon_threads = True
|
||||||
|
allow_reuse_address = True
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -702,10 +703,7 @@ def main():
|
||||||
global SHUTDOWN_REQUESTED
|
global SHUTDOWN_REQUESTED
|
||||||
|
|
||||||
port = int(os.environ.get("MOCK_FORGE_PORT", 3000))
|
port = int(os.environ.get("MOCK_FORGE_PORT", 3000))
|
||||||
# Set SO_REUSEADDR before creating the server to allow port reuse
|
server = ThreadingHTTPServer(("0.0.0.0", port), ForgejoHandler)
|
||||||
class ReusableHTTPServer(ThreadingHTTPServer):
|
|
||||||
allow_reuse_address = True
|
|
||||||
server = ReusableHTTPServer(("0.0.0.0", port), ForgejoHandler)
|
|
||||||
|
|
||||||
print(f"Mock Forgejo server starting on port {port}", file=sys.stderr)
|
print(f"Mock Forgejo server starting on port {port}", file=sys.stderr)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ if [ -n "$mock_state" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify labels were created
|
# Verify labels were created
|
||||||
labels_total=$(echo "$mock_state" | jq '[.labels.values[] | length] | add // 0' 2>/dev/null) || labels_total=0
|
labels_total=$(echo "$mock_state" | jq '[.labels | to_entries[].value | length] | add // 0' 2>/dev/null) || labels_total=0
|
||||||
if [ "$labels_total" -ge 5 ]; then
|
if [ "$labels_total" -ge 5 ]; then
|
||||||
pass "Mock state: ${labels_total} labels created (expected >= 5)"
|
pass "Mock state: ${labels_total} labels created (expected >= 5)"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue