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

fix: get tests passing on plucky #290

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions landscape/client/broker/tests/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,10 @@ def test_ssl_verification_negative(self):
message_api=b"X.Y",
)

def got_result(ignored):
def got_result(failure):
self.assertIs(r.request, None)
self.assertIs(r.content, None)
logfile_value = self.logfile.getvalue()
# pycurl error messages vary by version.
# First is for <= noble, second for > noble.
self.assertTrue(
"server certificate verification failed" in logfile_value
or "SSL certificate problem" in logfile_value,
)
self.assertEqual(failure.value.error_code, 60)

result.addErrback(got_result)
return result
10 changes: 9 additions & 1 deletion landscape/lib/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,15 @@ def fake():
# because the call might cancel it!
call._data = self.call_later(seconds, fake)._data
try:
f(*args, **kwargs)
deferred = f(*args, **kwargs)

if (
hasattr(deferred, "result")
and isinstance(deferred.result, Failure)
):
# Required for failures to get GC'd and properly flushed.
# Twisted did this for us in versions < 24.10.
deferred.result.cleanFailure()
except Exception:
if call.active:
self.cancel_call(call)
Expand Down
Loading