Ticket #2757 (closed enhancement: fixed )

Opened 2 years ago

Last modified 2 years ago

give TrafficLoggingFactory a public API to reset its counter

Reported by: exarkun Assigned to: therve
Type: enhancement Priority: highest
Milestone: Component: core
Keywords: Cc: therve, ralphm
Branch: Author:
Launchpad Bug:

Description

TrafficLoggingFactory? keeps track of how many connections have been made through it and uses this counter in constructing filenames to perform the logging. It would be useful, particularly for unit tests, if the counter could be reset to 0 via some public API.

In current trunk, twisted.test.test_policies.LoggingFactoryTestCase.testThingsGetLogged fails when run with trial -u since it doesn't account for the fact that the counter was incremented by a previous test.

Attachments

Change History

  2007-07-28 19:08:21+00:00 changed by therve

  • owner changed from glyph to therve

  2007-07-31 10:00:08+00:00 changed by therve

  • cc set to therve
  • priority changed from low to highest

The work is done in trafficlogging-counter-2757.

  2007-07-31 10:06:41+00:00 changed by exarkun

  • keywords set to review

  2007-07-31 10:16:56+00:00 changed by therve

  • owner deleted

  2007-08-03 13:44:35+00:00 changed by ralphm

  • cc changed from therve to therve, ralphm
  • keywords deleted
  • owner set to therve

Looks good. Please merge.

  2007-08-03 14:12:02+00:00 changed by therve

  • status changed from new to closed
  • resolution set to fixed

(In [20937]) Merge trafficlogging-counter-2757

Author: therve Reviewer: ralphm Close #2757

Add a resetCounter method to twisted.protocol.policies.TrafficLoggingFactory?, used to reset the counter of connections to 0. Also, use this API in the tests so that they pass with the --until-failure flag of trial.

  2007-08-03 15:23:44+00:00 changed by therve

(In [20942]) Revert r20937, wrong API defined.

Refs #2757

  2007-08-03 15:24:12+00:00 changed by therve

  • status changed from closed to reopened
  • resolution deleted

Sorry we can do better.

  2007-08-07 12:40:34+00:00 changed by therve

  • keywords set to review
  • owner deleted
  • status changed from reopened to new

OK, I cleaned it up a bit in [20974]. That should be better.

  2007-08-07 16:02:14+00:00 changed by ralphm

  • keywords deleted
  • owner set to therve

Maybe split out the test for _counter and and resetCounter. Otherwise seems to better, indeed.

I'd be ok with merging this.

  2007-08-08 09:33:28+00:00 changed by therve

(In [20991]) Add a specific test for resetCounter.

Refs #2757.

  2007-08-08 09:35:25+00:00 changed by therve

  • keywords set to review
  • owner deleted

Thanks, I added another test. Still need a little review for the new docstrings.

  2007-08-08 09:43:23+00:00 changed by ralphm

  • keywords deleted
  • owner set to therve

Works for me.

Please merge.

  2007-08-08 10:35:34+00:00 changed by therve

  • status changed from new to closed
  • resolution set to fixed

(In [21000]) Merge trafficlogging-counter-2757

Author: therve Reviewer: ralphm Fixes #2757

Add a resetCounter method to twisted.protocol.policies.TrafficLoggingFactory?, used to reset the counter of connections to 0. Also, refactor TrafficLoggingProtocol? so that it gets its counter from the factory instead of holding it as a class variable.

Note: See TracTickets for help on using tickets.