Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: implement readiness check before yielding local-http(s) test servers #12050

Conversation

jayaddison
Copy link
Contributor

@jayaddison jayaddison commented Mar 7, 2024

Feature or Bugfix

  • Bugfix

Purpose

  • Intended to prevent a flaky test failure from causing false-positive failure notices in Sphinx's continuous integration tests on GitHub Actions.

Detail

  • Implements a socket-based readiness check on each test HTTP(S) server created for use during unit tests before yielding it for use by the corresponding test case.

Relates

@jayaddison jayaddison changed the title tests: increase timeout for linkcheck local-https test server tests: implement healthcheck before yielding local-http(s) test servers Mar 7, 2024
@jayaddison jayaddison changed the title tests: implement healthcheck before yielding local-http(s) test servers tests: implement readiness check before yielding local-http(s) test servers Mar 7, 2024
@jayaddison
Copy link
Contributor Author

I'm going to push a few more commits for this momentarily, including a changelog entry. But this code also needs to be evaluated on a large-batch of Windows CI unit test builds, to check that it's reliable.

@jayaddison jayaddison requested a review from picnixz March 7, 2024 11:38
.github/workflows/main.yml Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
@picnixz
Copy link
Member

picnixz commented Mar 7, 2024

If you want to check whether it's reliable or not and you don't have access to Windows, just commit a space diff, then commit without the space and again just to trigger the CI/CD

tests/utils.py Outdated
@@ -45,7 +50,8 @@ def server(handler):
server_thread = thread_class(handler, daemon=True)
server_thread.start()
try:
yield server_thread
socket.create_connection(ADDRESS, timeout=0.5).close() # attempt connection.
Copy link
Member

@picnixz picnixz Mar 7, 2024

Choose a reason for hiding this comment

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

If you want to end your sentences with periods you should also start with a capital letter (I think it's fine not to have a period for non-capitalized small comments in general)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, that's reasonable :)

The full-stop was partly to reduce the chance that one or other of the lines could be deleted, leaving the other one parse as valid but without the relevant context.

@picnixz
Copy link
Member

picnixz commented Mar 8, 2024

Is it fine to merge? I don't have anything else to say

@jayaddison
Copy link
Contributor Author

Is it fine to merge? I don't have anything else to say

I count 50 Python test builds on Windows without seeing the failure occur again - that gives me reasonable (although not complete) confidence that it's OK to merge. Even so, I'll monitor the test results on mainline and PRs for the next few weeks.

@jayaddison
Copy link
Contributor Author

Shorter answer: yes, I think so.

(but after this many attempts I still won't be surprised if another Windows test failure does occur somehow!)

@picnixz picnixz merged commit 1bfddf8 into sphinx-doc:master Mar 8, 2024
22 checks passed
@picnixz
Copy link
Member

picnixz commented Mar 8, 2024

Thank you!

@jayaddison
Copy link
Contributor Author

And thank you for the review and merge!

@jayaddison jayaddison deleted the issue-12038/increase-https-selfsigned-test-timeout branch March 8, 2024 10:37
@jayaddison
Copy link
Contributor Author

I count 50 Python test builds on Windows without seeing the failure occur again - that gives me reasonable (although not complete) confidence that it's OK to merge. Even so, I'll monitor the test results on mainline and PRs for the next few weeks.

The same error message appeared again in #12065.

jayaddison added a commit to jayaddison/sphinx that referenced this pull request Mar 20, 2024
…servers (sphinx-doc#12050)

Co-authored-by: Bénédikt Tran <[email protected]>
(cherry picked from commit 1bfddf8)

Conflicts:
	CHANGES.rst
	tests/utils.py
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2024
@AA-Turner AA-Turner added this to the 7.3.0 milestone Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flaky unit test: test_build_linkcheck.test_connect_to_selfsigned_fails
3 participants