Skip to content

fix: use HTTPBIN_URL env var for CI, fall back to testcontainers locally#224

Open
sungdark wants to merge 1 commit into
com-lihaoyi:masterfrom
sungdark:fix-httpbin-local
Open

fix: use HTTPBIN_URL env var for CI, fall back to testcontainers locally#224
sungdark wants to merge 1 commit into
com-lihaoyi:masterfrom
sungdark:fix-httpbin-local

Conversation

@sungdark

@sungdark sungdark commented Apr 1, 2026

Copy link
Copy Markdown

Summary

Fixes lihaoyi/test#1219 - requests.RequestTests timing out connecting to external httpbin.org.

Problem

Tests were failing in CI with timeouts connecting to https://httpbin.org. The kennethreitz/httpbin Docker image via testcontainers may not start reliably in GitHub Actions without DinD configuration.

Solution

HttpbinTestSuite now checks for HTTPBIN_URL environment variable first:

  • CI: Set HTTPBIN_URL=http://localhost:8080 via GitHub Actions service container
  • Local dev: Falls back to testcontainers Docker container (existing behavior)

CI Change Needed

Add to .github/workflows/actions.yml:

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      httpbin:
        image: kennethreitz/httpbin:latest
        ports:
          - 8080:80
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: ./mill -i __.test
        env:
          HTTPBIN_URL: "http://localhost:8080"

Testing

  • Local: ./mill -i __.test (uses testcontainers automatically)
  • CI: Set HTTPBIN_URL env var to use the service container

- HttpbinTestSuite checks HTTPBIN_URL env var first (for CI service container)
- Falls back to testcontainers Docker container for local development
- Fixes timeout failures when CI cannot reach external httpbin.org
- Closes lihaoyi/test#1219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

requests.RequestTests fails trying to contact https://httpbin.org (200USD Bounty)

1 participant