Ticket #2757 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

give TrafficLoggingFactory a public API to reset its counter

Reported by: exarkun Owned by: therve
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.

Change History

Changed 3 years ago by therve

  • owner changed from glyph to therve

Changed 3 years ago by therve

  • cc therve added
  • priority changed from low to highest

The work is done in trafficlogging-counter-2757.

Changed 3 years ago by exarkun

  • keywords review added

Changed 3 years ago by therve

  • owner therve deleted

Changed 3 years ago by ralphm

  • owner set to therve
  • keywords review removed
  • cc ralphm added

Looks good. Please merge.

Changed 3 years ago 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.

Changed 3 years ago by therve

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

Refs #2757

Changed 3 years ago by therve

  • status changed from closed to reopened
  • resolution fixed deleted

Sorry we can do better.

Changed 3 years ago by therve

  • owner therve deleted
  • keywords review added
  • status changed from reopened to new

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

Changed 3 years ago by ralphm

  • owner set to therve
  • keywords review removed

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

I'd be ok with merging this.

Changed 3 years ago by therve

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

Refs #2757.

Changed 3 years ago by therve

  • owner therve deleted
  • keywords review added

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

Changed 3 years ago by ralphm

  • keywords review removed
  • owner set to therve

Works for me.

Please merge.

Changed 3 years ago 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.