Merge lp:~mandel/ubuntuone-dev-tools/tcp-testcases into lp:ubuntuone-dev-tools
| Status: | Merged |
|---|---|
| Approved by: | Alejandro J. Cura on 2012-04-13 |
| Approved revision: | 75 |
| Merged at revision: | 61 |
| Proposed branch: | lp:~mandel/ubuntuone-dev-tools/tcp-testcases |
| Merge into: | lp:ubuntuone-dev-tools |
| Diff against target: |
656 lines (+647/-0) 2 files modified
ubuntuone/devtools/testcases/tests/test_txtcpserver.py (+417/-0) ubuntuone/devtools/testcases/txtcpserver.py (+230/-0) |
| To merge this branch: | bzr merge lp:~mandel/ubuntuone-dev-tools/tcp-testcases |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Alejandro J. Cura (community) | 2012-03-28 | Approve on 2012-04-13 | |
| Manuel de la Peña (community) | Abstain on 2012-04-13 | ||
| dobey (community) | 2012-03-28 | Approve on 2012-04-13 | |
|
Review via email:
|
|||
Commit Message
- Added a two new test cases that allow to start a server and connect a client in a safe manner (LP: #963082)
Description of the Change
- Added a two new test cases that allow to start a service and connect a client in a safe manner (LP: #963082)
- 65. By Manuel de la Peña on 2012-04-09
-
Fixed code according to the reviews.
| dobey (dobey) wrote : | # |
38 +class Aditioner(
39 + """A remote aditioner."""
Bad spelling. And "Additioner" isn't a word. Maybe "Adder" would be what you want to call it?
Also, I am not fond of having the module be "tx" as it's not a general twisted module, but for a very specific feature which is provided by twisted. Perhaps "twistedpb" would be a better name. Maybe I'm wrong, but this seems like a specific set of test cases for use with testing usage of the IPC mechanism we've built for use on Windows using TCP. The naming should better reflect that, I think.
7 +# Copyright 2011 Canonical Ltd.
419 +# Copyright 2011 Canonical Ltd.
The year is not 2011 any more. Stop living in the past!
Also, all copyright headers need to include the block of text for the OpenSSL exception. You can see it in the other source files now, as well as LICENSE in the root of the tree.
492 +class SaveServiceRunn
Can you please explain the usage of the terms "Save" and "Service" in this code? It seems to me for "Service" you mean "twisted pb server" though it isn't entirely clear. And I have no idea what "Save" is supposed to mean in any of the contexts here.
- 66. By Manuel de la Peña on 2012-04-12
-
Made changes according to review.
- 67. By Manuel de la Peña on 2012-04-12
-
Fixed errors during the merge.
- 68. By Manuel de la Peña on 2012-04-12
-
Merged with trunk updated license.
- 69. By Manuel de la Peña on 2012-04-12
-
Use the correct dates.
| dobey (dobey) wrote : | # |
I still see plenty usage of "save" and "Save" in the code. Is this not supposed to be "safe" and "Safe" instead?
| Alejandro J. Cura (alecu) wrote : | # |
Great work on this branch, mandel!
I love that the SafeTCPServer internally handles the port and that there's no need for the user of this classes to worry about that.
I'm going to ask for a change, though I'm already hearing you cursing from afar :-)
So, looking at test_multiple_
My requested change is to simplify the API so, instead of having a SafeTCPServer for multiple ServerFactories...
... we would have one SafeTCPServer *per* ServerFactory, like this:
The above change means that a lot of code and complexity in SafeTCPServer can be chopped by removing the self.server_
Even better it would be to be allow multiple client connections to the same SafeTCPServer, but I think that it can wait till a later branch.
Oh, and two smaller issues:
1) I think we should somehow mark the instance attributes added to the factories so they don't collide with similar attributes that may be added by the code being tested. For instance, instead of .disconnecting or .on_connection_
2) I agree with dobey regarding the "Safe" and "Save" terminology. Instead of "SafeTCPServer" we should find another name that conveys a bit better what this classes are about. My (admittedly also ugly) proposals: "CleanableTCPSe
| Manuel de la Peña (mandel) wrote : | # |
> Great work on this branch, mandel!
>
> I love that the SafeTCPServer internally handles the port and that there's no
> need for the user of this classes to worry about that.
>
> I'm going to ask for a change, though I'm already hearing you cursing from
> afar :-)
>
> So, looking at test_multiple_
> used for both listen_server calls. I think this adds a lot of seemingly
> unneeded complexity in SafeTCPServer, that needs the self.server_
> dictionary and associated dict entries for each connection, and then each
> client needs to specify which server it wants to connect to as the first
> parameter to connect_client(). This also limits to one the number of servers
> of a given class that can be started with each SafeTCPServer.
>
> My requested change is to simplify the API so, instead of having a
> SafeTCPServer for multiple ServerFactories...
>
> self.tcp_server = SafeTCPServer()
> calculator_s = self.tcp_
> self.calculator)
> self.addCleanup
> calculator_c = self.tcp_
> pb.PBClientFactory)
>
> ... we would have one SafeTCPServer *per* ServerFactory, like this:
>
> self.tcp_server = SafeTCPServer(
> self.addCleanup
> calculator_c = self.tcp_
>
> The above change means that a lot of code and complexity in SafeTCPServer can
> be chopped by removing the self.server_
Sure, no problem what so ever, will be ready by the time you are back :)
>
> Even better it would be to be allow multiple client connections to the same
> SafeTCPServer, but I think that it can wait till a later branch.
>
> Oh, and two smaller issues:
>
> 1) I think we should somehow mark the instance attributes added to the
> factories so they don't collide with similar attributes that may be added by
> the code being tested. For instance, instead of .disconnecting or
> .on_connection_
> like _testserver_
>
Ok
> 2) I agree with dobey regarding the "Safe" and "Save" terminology. Instead of
> "SafeTCPServer" we should find another name that conveys a bit better what
> this classes are about. My (admittedly also ugly) proposals:
> "CleanableTCPSe
Does sound terrible, what a bout TidyTCPServer?
- 70. By Manuel de la Peña on 2012-04-13
-
Done the following per reviews:
1. Simplified the API so that the service runner only runs one service.
2. Renamed the deferreds so that the names are more explicit to avoid colisions.
3. Renamed the runner to use 'tidy' whichs explains better its use. - 71. By Manuel de la Peña on 2012-04-13
-
clean_up does notlonger need to get the factory to clean.
- 72. By Manuel de la Peña on 2012-04-13
-
Use tidy not save/safe.
- 73. By Manuel de la Peña on 2012-04-13
-
Do not use save.
| dobey (dobey) wrote : | # |
+class ServerSaveProto
+class ClientSaveProto
These 2 are left. ;)
| dobey (dobey) wrote : | # |
+class MultipleSercice
Also, just caught this spelling faux pas. But weren't we also going to use the term "Server" for all these as well?
- 74. By Manuel de la Peña on 2012-04-13
-
Do no use save.
- 75. By Manuel de la Peña on 2012-04-13
-
Remove the use of the word service, is misleading.

444 +def server_ protocol_ factory( cls=protocol. Protocol) : protocol_ factory( cls=protocol. Protocol) :
.
.
.
465 +def client_
Since the above functions are never used with optional arguments, they should take only one mandatory argument. col.connected_ clients. append( self)
----
479 + ClientSaveProto
What's the list of connected_clients used for?
Instead of a class variable of ClientSaveProtocol, it should be an instance variable of the twisted factory that creates all these instances, and that's usually available as "self.factory" inside the protocol instnace.
----
"is a complicated manner." -> "is a complicated matter."
"arre" -> "are"
'%shas not started' <- missing space