Skip to content

Conversation

@miguelgrinberg
Copy link
Contributor

@miguelgrinberg miguelgrinberg commented Jul 7, 2025

Replace calls to httpbin.org with a locally hosted hhtpbin server to avoid the high number of 502s in test runs. The pytest-httpbin plugin is used for this. There is a test that requires a certificate chain. For that I'm using www.elastic.co instead of the flaky httpbin.org, which hopefully is going to be more reliable. I also haven't touched the tests that send requests to badssl.com, since those appear to be stable in CI.

@miguelgrinberg miguelgrinberg force-pushed the use-local-httpbin branch 9 times, most recently from 00b3559 to 79ae29a Compare July 8, 2025 19:38
@miguelgrinberg miguelgrinberg changed the title Use a locally hosted httpbin for tests Use a locally hosted services for tests Jul 9, 2025
@miguelgrinberg miguelgrinberg marked this pull request as ready for review July 9, 2025 09:43
@miguelgrinberg miguelgrinberg requested a review from pquentin July 9, 2025 09:44
@miguelgrinberg miguelgrinberg changed the title Use a locally hosted services for tests Use locally hosted services for tests Jul 9, 2025
Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a great step forward - there are possible improvements, but they can be treated as follow ups.


@pytest.mark.asyncio
async def test_async_transport_httpbin(httpbin_node_config):
async def test_async_transport_httpbin(httpbin_node_config, httpbin):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: as a follow-up, we could add an url property to NodeConfig, which would avoid accepting both httpbin and httpbin_node_config. (It took me a while to understand.)

Comment on lines 92 to 93
# This is the root CA for httpbin.org with a leading comma to denote more than one cert was listed.
assert ', "8ecde6884f3d87b1125ba31ac3fcb13d7016de7f57cc904fe1cb97c6ae98196e"' in err
assert ', "cbb522d7b7f127ad6a0113865bdf1cd4102e7d0759af635a7cf4720dc963c53b"' in err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The certificate is currently generated by trustme: kevin1024/pytest-httpbin#90. Since it generates its own CA, this is going to be less stable than before. Additionally, the comment is out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the root CA for www.elastic.co, this is the one test that does not use the local httpbin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry. This should be pretty stable. Can we update the comment above then?

@miguelgrinberg miguelgrinberg merged commit 23d0f56 into main Jul 10, 2025
20 checks passed
@miguelgrinberg miguelgrinberg deleted the use-local-httpbin branch July 10, 2025 13:18
github-actions bot pushed a commit that referenced this pull request Jul 10, 2025
* Use a locally hosted httpbin for tests

* use a www.elastic.co instead of httpbin.org for SSL tests

* use pytest-httpbin instead of a local service

* use pytest-httpbin also for SSL tests

* fix inaccurate comment

(cherry picked from commit 23d0f56)
github-actions bot pushed a commit that referenced this pull request Jul 10, 2025
* Use a locally hosted httpbin for tests

* use a www.elastic.co instead of httpbin.org for SSL tests

* use pytest-httpbin instead of a local service

* use pytest-httpbin also for SSL tests

* fix inaccurate comment

(cherry picked from commit 23d0f56)
github-actions bot pushed a commit that referenced this pull request Jul 10, 2025
* Use a locally hosted httpbin for tests

* use a www.elastic.co instead of httpbin.org for SSL tests

* use pytest-httpbin instead of a local service

* use pytest-httpbin also for SSL tests

* fix inaccurate comment

(cherry picked from commit 23d0f56)
miguelgrinberg added a commit that referenced this pull request Jul 10, 2025
* Use a locally hosted httpbin for tests

* use a www.elastic.co instead of httpbin.org for SSL tests

* use pytest-httpbin instead of a local service

* use pytest-httpbin also for SSL tests

* fix inaccurate comment

(cherry picked from commit 23d0f56)

Co-authored-by: Miguel Grinberg <[email protected]>
miguelgrinberg added a commit that referenced this pull request Jul 10, 2025
* Use a locally hosted httpbin for tests

* use a www.elastic.co instead of httpbin.org for SSL tests

* use pytest-httpbin instead of a local service

* use pytest-httpbin also for SSL tests

* fix inaccurate comment

(cherry picked from commit 23d0f56)

Co-authored-by: Miguel Grinberg <[email protected]>
miguelgrinberg added a commit that referenced this pull request Jul 10, 2025
* Use a locally hosted httpbin for tests

* use a www.elastic.co instead of httpbin.org for SSL tests

* use pytest-httpbin instead of a local service

* use pytest-httpbin also for SSL tests

* fix inaccurate comment

(cherry picked from commit 23d0f56)

Co-authored-by: Miguel Grinberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants