Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Pick random ports on tests #90

Closed
hackergrrl opened this issue Mar 17, 2016 · 6 comments
Closed

Pick random ports on tests #90

hackergrrl opened this issue Mar 17, 2016 · 6 comments
Labels
exp/expert Having worked on the specific codebase is important

Comments

@hackergrrl
Copy link
Contributor

We ought to gracefully use port zero (like go-ipfs).

  1) http api "before all" hook:
     Uncaught AssertionError: expected [Error: listen EADDRINUSE 127.0.0.1:9090] to not exist
      at tests/test-http-api/index.js:18:27
      at src/http-api/index.js:55:18
      at node_modules/hapi/lib/server.js:269:20
      at done (node_modules/hapi/node_modules/items/lib/index.js:23:21)
      at Server.onError (node_modules/hapi/lib/connection.js:163:16)
      at emitErrorNT (net.js:1253:8)
@daviddias
Copy link
Member

go-ipfs doesn't use port 0 for the Gateway, which is where that is failing.

{
  "API": "/ip4/127.0.0.1/tcp/5001",
  "Gateway": "/ip4/127.0.0.1/tcp/8080",
  "Swarm": [
    "/ip4/0.0.0.0/tcp/4001",
    "/ip6/::/tcp/4001"
  ]
}

It is strange however, because I changed the config to launch the http-api on port 9090 to avoid those kind of collisions, but it seems that you had something else running on port 9090?

@hackergrrl
Copy link
Contributor Author

It does for tests (https://github.com/ipfs/go-ipfs/blob/master/test/sharness/lib/test-lib.sh#L149), and we should too. I run other software on 8080, so I run the gateway on 9090, as may many other users -- 8080 is pretty popular and 9090 is the next most "logical" choice. ;)

@daviddias daviddias changed the title Tests fail if there is already an ipfs daemon running on the system Pick random ports on tests Mar 21, 2016
@daviddias
Copy link
Member

Got it, could you submit a PR for that?

@daviddias daviddias added enhancement exp/novice Someone with a little familiarity can pick up labels Mar 21, 2016
@hackergrrl hackergrrl removed their assignment Mar 21, 2016
@hackergrrl hackergrrl added help wanted exp/expert Having worked on the specific codebase is important and removed exp/novice Someone with a little familiarity can pick up labels Mar 21, 2016
@hackergrrl
Copy link
Contributor Author

This isn't on my short term list, so let's open it up as Help Wanted until it gets picked up.

@nginnever
Copy link
Member

Took a shot at it, was actually playing with this last night.

#94

@daviddias
Copy link
Member

thank you :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important
Projects
None yet
Development

No branches or pull requests

3 participants