Opened 7 years ago

Closed 3 years ago

#1215 closed defect (fixed)

Unit tests may run a router (and reseed it)

Reported by: dg Owned by: slumlord
Priority: minor Milestone: 0.9.36
Component: router/general Version: 0.9.11
Keywords: privacy Cc:
Parent Tickets: Sensitive: no


Some of our unit tests may start up a full router from scratch and, in turn, reseed from the open internet. This could cause anonymity issues for some developers or service providers (those perhaps willing to run any CI/Jenkins eepsite that covers all of the codebase tests).

The problematic tests should be disabled by default (when running all tests, require them to be explicitly turned on) or 'reseed' from a local router instead.


Change History (9)

comment:1 Changed 7 years ago by zzz

Component: unspecifiedrouter/general


comment:2 Changed 6 years ago by str4d

Keywords: privacy added
Milestone: 0.9.12

comment:3 Changed 5 years ago by str4d

Status: newopen

comment:4 Changed 4 years ago by slumlord

Bumping this, I am running BobTheBuilder?.i2p and am currently wrapping ant test with torify to get around this issue. Running ant test on a system with no clearnet access causes ant test to take upwards of 45 minutes.

comment:5 Changed 4 years ago by zzz

Owner: set to str4d
Status: openassigned

There's a couple of choices here.

1) change all router unit tests to prevent any net access (basically, disable reseed, disable NTP, enable vmcommsystem)

2) create an ant target that runs all unit tests except those that require net access

Not sure which is easier. I'd prefer 1) if possible, although 2) might be a short-term fix. Assigning to str4d to research/comment/address, he's the unit test maintainer right now, more or less

I believe the delay w/o any access is caused by the wait-for-NTP time in the router startup.

Might be nice, for starters, to identify each test that starts a router now, and which of those actually require net access, and if the test it does is useful. slumlord could perhaps help with that, as he must have test logs from bobthebuilder.

comment:6 Changed 3 years ago by slumlord

Going to see if tests that require internet access can be identified and split into their own ant target. This would allow the tests to be run on a system specifically set up for these internet-related tests.

Looking through build.xml:

$ grep -in '<target name="test"' build.xml
1878:    <target name="test" depends="testCore, testRouter, testMinistreaming, testStreaming" />


    <target name="testCore" depends="buildProperties, jbigi" >                                                                                                                 
        <ant dir="core/java/" target="test" />                                                                                                                                 
    <target name="testRouter" depends="buildProperties, jbigi" >                                                                                                               
        <ant dir="router/java/" target="test" />                                                                                                                               
    <target name="testMinistreaming" depends="buildProperties, jbigi" >                                                                                                        
        <ant dir="apps/ministreaming/java/" target="test" />                                                                                                                   
    <target name="testStreaming" depends="buildProperties" >                                                                                                                   
        <ant dir="apps/streaming/java/" target="test" />                                                                                                                       

/i2p.i2p/core/java/test/junit/net/i2p/ defines tests:

public class AllCoreTests {


$ find . -iname '*'


$ find . -iname '*'


$ find . -iname '*'


  • Read and understand tests
  • Identify tests that require internet access

comment:7 Changed 3 years ago by zzz

Milestone: 0.9.36
Owner: changed from str4d to slumlord

Should only be some of the ones in router/java/test.
Note that there are also scala unit tests, but there aren't any for the router.
Alternate plan after identifying tests - disable them, or rewrite so they don't need a running router. Based on the names, they shouldn't need a full router.

comment:8 Changed 3 years ago by slumlord

Found and fixed a configuration problem on the build system which was causing builds to take a lot longer when torsocks wasn't used with ant test. System was using an IP in the subnet (not and the tests were hanging when trying to determine the loopback IP address.

zzz, anything further to be done here?

comment:9 Changed 3 years ago by slumlord

Resolution: fixed
Status: assignedclosed

Have not heard anything from zzz. As far as I can tell tests run just fine without network access, either directly or through tor.

Closing as fixed.

Note: See TracTickets for help on using tickets.