Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(11573)

Issue 43650050: Add a twisted log client

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 4 months ago by ekasper
Modified:
10 years, 2 months ago
Reviewers:
Al Cutter, Eran
CC:
ctlog-opensource-review_google.com
Visibility:
Public.

Description

Add a twisted log client

Patch Set 1 #

Patch Set 2 : Add tests for ResponseBodyHandler #

Patch Set 3 : fix comment #

Patch Set 4 : fix scripts, bump twisted version #

Patch Set 5 : use successResultOf #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+678 lines, -287 lines) Patch
M src/python/Makefile View 1 chunk +2 lines, -0 lines 0 comments Download
M src/python/README View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A src/python/ct/client/async_log_client_test.py View 1 2 3 4 1 chunk +137 lines, -0 lines 4 comments Download
M src/python/ct/client/log_client.py View 1 2 3 13 chunks +226 lines, -87 lines 7 comments Download
M src/python/ct/client/log_client_test.py View 1 9 chunks +100 lines, -196 lines 0 comments Download
A src/python/ct/client/log_client_test_util.py View 1 chunk +180 lines, -0 lines 0 comments Download
M src/python/ct/client/prober.py View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
A src/python/ct/client/tools/async_client_example.py View 1 chunk +30 lines, -0 lines 0 comments Download
M src/python/ct/client/tools/scan.py View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 6
ekasper
Hi Al, This is my Christmas present to you, I hope you like it! It's ...
10 years, 4 months ago (2013-12-19 16:05:49 UTC) #1
ekasper
I'm not in a hurry but just in case this fell through the cracks of ...
10 years, 3 months ago (2014-01-10 14:04:16 UTC) #2
Al Cutter
lgtm (merry christmas!)
10 years, 3 months ago (2014-01-13 15:02:35 UTC) #3
Eran
Drive-by LGTM and some minor comments. https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/async_log_client_test.py File src/python/ct/client/async_log_client_test.py (right): https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/async_log_client_test.py#newcode23 src/python/ct/client/async_log_client_test.py:23: transport = proto_helpers.StringTransportWithDisconnection() ...
10 years, 3 months ago (2014-01-16 14:09:48 UTC) #4
ekasper
Eran, I've already submitted this but I'd put together a follow-up. Could you clarify a ...
10 years, 3 months ago (2014-01-20 15:19:58 UTC) #5
Eran
10 years, 2 months ago (2014-02-04 11:59:18 UTC) #6
Clarified.

https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/async...
File src/python/ct/client/async_log_client_test.py (right):

https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/async...
src/python/ct/client/async_log_client_test.py:58: # TODO(ekasper): find a more
elegant and robust way to save flags.
On 2014/01/20 15:20:00, ekasper wrote:
> On 2014/01/16 14:09:49, Eran wrote:
> > Such as a parameter to the c'tor?
> 
> I'm afraid I don't follow you here: could you spell it out for me?

Simply pass in the value of FLAGS.response_buffer_size_bytes into the
ResponseBodyHandler constructor, rather than save and restore flags for tests.

https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/log_c...
File src/python/ct/client/log_client.py (right):

https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/log_c...
src/python/ct/client/log_client.py:102: class RequestHandler(object):
On 2014/01/20 15:20:00, ekasper wrote:
> On 2014/01/16 14:09:49, Eran wrote:
> > Just curious, why not mock out the 'requests' package directly? 
> > Other than translating error codes, that class does not seem like it does
> much.
> > If we want to decouple our code from 'requests', that'd make sense.
> 
> I'm not sure what the pythonic way is here but... if we want to decouple the
> code from 'requests', doesn't it make _more_ sense to use a wrapper class?
> 
> Right now I could at least theoretically change the handler to use another
> module underneath without modifying the tests. But if I mock (using
mock.patch?)
> the module directly then the unit tests will have to become aware of requests.
> 

Sorry, should have been clearer: If the goal of this wrapper class is to ease
testing, then I think using mock.patch to mock 'requests' module is perfectly
fine. I don't see an issue with the tests knowing about the implementation's use
of 'requests'.

https://codereview.appspot.com/43650050/diff/80001/src/python/ct/client/log_c...
src/python/ct/client/log_client.py:475: self._buffer.append(data)
On 2014/01/20 15:20:00, ekasper wrote:
> On 2014/01/16 14:09:49, Eran wrote:
> > nit: self._buffer.extend(data) so that later on you won't need to join all
> > pieces in the buffer.
> 
> How does .extend() save me from eventually joining the list?
> 

Sorry, meant concatenating into a string. Actually, this is fine  - more
efficient to create the string once.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b