carbon-io / carbond

MIT License
2 stars 5 forks source link

Tests swallow port taken error #219

Open chrisckchang opened 7 years ago

chrisckchang commented 7 years ago

Reproduce:

  1. git clone https://github.com/carbon-io-guides/example__zipcode-service
  2. cd example__zipcode-service && npm install
  3. node lib/ZipcodeService.js
  4. node test/ZipcodeServiceTest.js // this will output the following:
Running ZipcodeServiceTest...
  [-] ZipcodeServiceTest (0ms) FAILURE

Test Report
[*] Test: ZipcodeServiceTest (0ms)
    MongoError: topology was destroyed

to fix:

  1. node lib/ZipcodeService.js -p 9999 // run on different port than test
  2. node test/ZipcodeServiceTest.js
    Tests pass
gregbanks commented 7 years ago

https://github.com/carbon-io/carbond/commit/e45e5d296632ea76f0a6544229ade92e4e393f7b

chrisckchang commented 7 years ago

tried this commit, still receiving the same "topology was destroyed" error when i try to run the test

gregbanks commented 7 years ago

this is the line causing that error to be thrown:

https://github.com/carbon-io-guides/example__zipcode-service/blob/master/test/ZipcodeServiceTest.js#L45

otherwise you should see Error: listen EADDRINUSE 0.0.0.0:8888

chrisckchang commented 7 years ago

current workaround is to put try/catch around setup or teardown