[tor-bugs] #9874 [BridgeDB]: Research/design a way to automate testing of BridgeDB's HTTPS and email distributors

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Aug 7 12:48:28 UTC 2014


#9874: Research/design a way to automate testing of BridgeDB's HTTPS and email
distributors
-------------------------+-------------------------------------------------
     Reporter:  isis     |      Owner:  isis
         Type:           |     Status:  needs_revision
  enhancement            |  Milestone:
     Priority:  normal   |    Version:
    Component:           |   Keywords:  bridgedb-unittests, automation, ci,
  BridgeDB               |  bridgedb-gsoc-application
   Resolution:           |  Parent ID:
Actual Points:           |
       Points:           |
-------------------------+-------------------------------------------------

Comment (by isis):

 Replying to [comment:11 trygve]:
 > Attached 'test_smtp.py'. This is a test suite used to test the BridgeDB
 SMTP autoresponder. All tests are written to use twister.trial. The suite
 currently has three tests:
 >  '''test_getBridges''': sends an email to BridgeDB and checks that a
 response is received containing bridge details
 >  '''test_getBridges_rateLimitExceeded''': sends 3 emails to BridgeDB
 from the same email address and checks that the correct rate-limited
 response is received in each case
 >  '''test_getBridges_stressTest''': sends 100 emails from random email
 addresses on the same domain, and checks that a response is received in
 each case
 >
 > To run the tests:
 >  set EMAIL_SMTP_PORT in bridgedb.conf to 2525
 >  add "127.0.0.1" to EMAIL_DOMAINS in bridgedb.conf
 >  generate some bridge descriptors
 >  run bridgedb
 >  run 'trial test_smtp.py' from within the bridgedb virtualenv

 The changes for your `test_smtp.py` script are in my `fix/9874-email`
 [https://gitweb.torproject.org/user/isis/bridgedb.git/shortlog/refs/heads/fix/9874-email
 branch]. [http://travis-ci.org/isislovecruft/bridgedb/builds/31905793 All
 your tests pass] (at least the `test_smtp.py` ones do).

 I think that using `asynccore`, `threading`, and `smtplib`, while
 seemingly odd when Twisted provides this, is the right way to go for these
 tests. Twisted.trial tests which depend upon real networking are highly
 prone to difficult-to-debug problems with Twisted's reactor getting dirty,
 etc. Not to mention that using `twisted.mail.smtp` to essentially test the
 usage of `twisted.mail.smtp` in `bridgedb.email` seems... I'm not sure
 what the word is... like a truism? As in, the quirks in
 `twisted.mail.smtp` probably won't show up if we use `twisted.mail.smtp`
 to test it.

 So, this script look fine to me. It depends on the extra changes I made in
 the `fix/9874-https` branch mentioned above, so that one
 `test_get_obfs3_ipv6` unittest will still need to be fixed and I'll merge
 everything.

 Thanks again!

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9874#comment:17>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list