Opened 6 years ago

Closed 4 years ago

#11141 closed task (wontfix)

Create unit-tests for weather components

Reported by: baumanno Owned by:
Priority: Medium Milestone:
Component: Metrics/Tor Weather Version:
Severity: Keywords: weather-rewrite
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


In order to make current work and future integration as stable and seamless as possible, we should cover all code by unit-tests.

To start with, we could begin with a test suite containing all re-written components and move towards full coverage once the integration is stable.

Unless any team member has prior experience with testing Python/Django applications (Nose looks promising), I suggest we stick with Python's unittest-module for the following reasons:
a) preferred way of testing Django
b) part of batteries-included Python - no extra installation necessary, which lends itself well to portability

Measuring code coverage and performing CI could be possible next steps.

Child Tickets

Change History (3)

comment:1 Changed 6 years ago by meejah

jondbaker submitted a pull-request ( with some unit-tests. I have rebased that and pulled out just the utests (i.e. not the requirements + build script) into

I had to change the utests a little because of the versus "real" uri stuff we put in for Vagrant.

I will pull in the requirements + build-stuff in a separate merge.

There are still 2 unit-test failures, and I'm not entirely sure which is right (the code or the test). The tests may be run via "python weather/ test" from the top-level.

comment:2 Changed 6 years ago by karsten

I think that unit tests are wrong here. If you grep for "grace_pd" in, you'll find:

                                          'node_down_grace_pd' : '',
        self.assertEqual(node_down_sub.grace_pd, 1)
                                          'node_down_grace_pd' : '',
                                          'node_down_grace_pd' : '',
                                          'node_down_grace_pd' : 1,
                                          'node_down_grace_pd' : '',
        self.assertEqual(node_down_sub.grace_pd, 1)
                                          'node_down_grace_pd' : '',

It seems we're setting the node-down grace period to the empty string in most cases, but just once to 1 (hour). But we're asserting that it's 1 hour in different unit tests than the one where we're setting it to 1. I'd say let's remove those two asserts, or change them to 0. And we might want to move one such assert to the unit test where we're actually setting a node-down grace period.

comment:3 Changed 4 years ago by karsten

Resolution: wontfix
Status: newclosed

Tor Weather has been discontinued as of May 24, 2016: Batch-closing all remaining tickets as announced in #19382. A list of these tickets and any other Weather tickets modified after June 26, 2016 will be available here:^Metrics%2FTor+Weather

Note: See TracTickets for help on using tickets.