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 3 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 @@
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)

Check warning on line 199 in landscape/client/broker/tests/test_transport.py

View check run for this annotation

Codecov / codecov/patch

landscape/client/broker/tests/test_transport.py#L199

Added line #L199 was not covered by tests

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 some failures to get GC'd properly flushed.
# Twisted did this in versions < 24.10, but now we have to.
wck0 marked this conversation as resolved.
Show resolved Hide resolved
deferred.result.cleanFailure()
except Exception:
if call.active:
self.cancel_call(call)
Expand Down