-
Notifications
You must be signed in to change notification settings - Fork 23
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
[Fixes #86] Close the HTTP pool when service is stopped. #140
Conversation
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
=========================================
Coverage ? 99.26%
=========================================
Files ? 27
Lines ? 2044
Branches ? 179
=========================================
Hits ? 2029
Misses ? 11
Partials ? 4
Continue to review full report at Codecov.
|
Instead of passing an jws_client to txacme.client.Client(jws_client) maybe the API can be changed to pass an Agent. I do want to run txacme with a different agent, but I don't see why I would want a different JWSClient or a different Treq client. Also, in tests in better to mock the lowest I/O level so Twisted Agent is much lower than JWSClient. Right now I am using something like this in an HTTP factory where I am explicitly creating the agent and stoping the agent. My In this way, I am not touching the private stuff.
|
Thanks for the PR! I hope to review this soon. A quick note: to control what port the integration tests listen on, use |
No hurry. This actual code change in this PR was just to get going with txacme dev and see how good the current tests are. This can be on hold. I will need to start fixing #81 and then come back here. I will try to document I was expecting the tests to fail...so they are not that good. Note that from the service I am calling So it looks like, for now, there are no tests for the real deal. I have pushed a new change which I think that is better as it touches less private things, but it breaks the tests as the tests are using For my tests I am using a this code https://gist.github.com/adiroiban/a3dae64d14a56e8c0dbfea4bc6b4b827 In which for unit tests I use For functional tests I use |
I have pushed a new API proposal. I think that this might be a better API, once txacme will also support account registration. You can handle the account registration via the Client outside of the AcmeIssuingService and then AcmeIssuingService don't have to handle the registration. I feel that once registration is added, there will be too much logic in AcmeIssuingService so extracting |
Any update on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :) A few minor things to fix.
"soon" :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some failing tests; mostly looks like wrong argument passing.
src/txacme/client.py
Outdated
self._current_request.cancel() | ||
self._current_request = None | ||
|
||
agent_pool = getattr(self._agent, 'pool', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is supposed to be '_pool'
…
src/txacme/client.py
Outdated
|
||
agent_pool = getattr(self._agent, 'pool', None) | ||
if agent_pool: | ||
return self._agent._pool.closeCachedConnections() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…and this agent_pool
.
thanks @mithrandi for the review. I will work at fixing the tests and will send it for another round of reviews. this is not ready for review or merge |
It looks like there is a leaking tests... If I run just It looks like there is a bug in I am not familiar with testtools. |
@mithrandi if you have time, please take a look at this PR and maybe you will know how to fix the failing tests. The failure of Thanks! |
In terms of I think that twisted should provide the barebone low level API, and maybe have something like treq.client.HTTPClient.shutdown() high level API. |
I have enabled the debugging for DelayedCall and I found the issue... it was src/txacme/test/test_endpoint.py:test_parser will try to see how to fix it. |
Ok... so the issue is in Treq... when treq makes a request with timeout, it will not use the agent's reactor to schedule the timeout, but will use its own default reactor ... Looks like this is an already know issue twisted/treq#257 I have fixed it by updating the API to take a "timeot" and set it to 0 in the test. I hope that this time the tests are green and we can merge it. With these green tests I am more confident in txacme and can start working on ACMEv2... I already got a pebble docker container on my local system and I am looking into v2 protocol |
Tests are failing due to txacme and hypotesis dependencies. v1 support was removed form txacme v1.0.0 and newer.... so I have updated setup.py to use pre 1.0.0 versions. For hypotesis... I don't know.. I have pinned it as I think that we should pin dev dependencies.... but that might need For me using things like eliot or hypothesis makes txacme more complex.. and I don't see how this makes txacme simpler or easier to use |
Working on some fixes in #152 |
Thanks @mithrandi . While working on #152 maybe you can also include 793ea76 (with the exception of that "return") And maybe use TXACME test case for all txacme test.. In this way is easier to catch tests with side effects I am now happy with this branch. I start working on ACME v2 |
#152 is now merged although there are unfortunately conflicts now. |
I think that I can resolve them... |
if we migrate to acmev2, in theory we could downoad pebble binary on Traci-CI and run some integration tests against the local pebble Using the staging ACME is complicated due to setting up port 80 |
So I think this is ready to land once the tests are green. There seem to be two failure causes:
|
I have fixed the docs... I have no idea why it was not finding the Deferred reference The twisted lowers failure looks like an error from a different test. I have executed just the integration tests in the twlowest env and they pass
So I think it is just a matter of luck why those tests don't fail with latest Twisted The offending test is txacme.test.test_endpoint.PluginTests.test_parser
The problem is that I have fixed the timeout for JWS client, but that test is using the reactor to connect I will try to fix the test |
Thanks for the merge :) This was hard but we made good progress. |
Thanks for the PR :) |
In addition to introducing a nasty regression (#154) this failed to update the documentation (" |
Scope
This tries to fixes #86
When the service is stopped, it should automatically clean the resource and not left files opened or connections openend.
As a drive by, I added diff_cover reporting in coverage-report as is easier to see the branch coverage on my local system rather than rely on codecov.
Changes
For now I have hacked it the ugly way based and the code used in the tests.
As a drive by, I have documented the dev tools and created a GitHub template for future PRs.
How to review
testools has a strange taste and is hard to chew :) but in the end I manage to understand do something with this.
still, this does not makes sense and it does not check the exception type.
The integration tests are not executed on my computer.
I am running some tests, but the public port 80 is forwareded to my computer on port 8081 so that I don't have to deal extra config to listen on port below 1024.
So I think that besides
$ACME_HOST
we should also have an internal$ACME_CLIENT_PORT
on which the test is listening.I might need to work on #81 before merging this as otherwise is hard to test.
This change is