ExchangeUnion / xud

Exchange Union Daemon 🔁 ⚡️
https://exchangeunion.com
GNU Affero General Public License v3.0
115 stars 44 forks source link

npm run test - using xud1,2,3 and error #476

Closed offerm closed 6 years ago

offerm commented 6 years ago

Running npm run test. All tests pass but there is an ugly error:

  25 passing (356ms)

9/14/2018, 10:32:05 AM [P2P] warn: error while opening connection to peer (028599d05b18c0c3f8028915a17d603416f7276c822b6b2d20e71a3502bd0f9e0a): could not connect to peer at xud2.test.exchangeunion.com:8885: connect ECONNREFUSED 35.231.171.148:8885
Error: ConnectionManager.getConnection was called after the connection manager was closed!
    at ConnectionManager.getConnection (/Users/admin/github/xud/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:86:29)
    at Promise.try (/Users/admin/github/xud/node_modules/sequelize/lib/sequelize.js:554:34)
    at tryCatcher (/Users/admin/github/xud/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/admin/github/xud/node_modules/bluebird/js/release/method.js:39:29)
    at retryParameters (/Users/admin/github/xud/node_modules/sequelize/lib/sequelize.js:454:48)
    at /Users/admin/github/xud/node_modules/retry-as-promised/index.js:39:21
    at Promise._execute (/Users/admin/github/xud/node_modules/bluebird/js/release/debuggability.js:303:9)
    at Promise._resolveFromExecutor (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:79:10)
    at retryAsPromised (/Users/admin/github/xud/node_modules/retry-as-promised/index.js:29:10)
    at Sequelize.query (/Users/admin/github/xud/node_modules/sequelize/lib/sequelize.js:454:12)
    at QueryInterface.update (/Users/admin/github/xud/node_modules/sequelize/lib/query-interface.js:1028:27)
    at Promise.try.then.then.then (/Users/admin/github/xud/node_modules/sequelize/lib/model.js:3691:53)
    at tryCatcher (/Users/admin/github/xud/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/admin/github/xud/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/admin/github/xud/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/admin/github/xud/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:693:18)
    at tryOnImmediate (timers.js:664:5)
    at processImmediate (timers.js:646:5)

/Users/admin/github/xud/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:86
      return Promise.reject(new Error('ConnectionManager.getConnection was called after the connection manager was closed!'));
                            ^
Error: ConnectionManager.getConnection was called after the connection manager was closed!
    at ConnectionManager.getConnection (/Users/admin/github/xud/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:86:29)
    at Promise.try (/Users/admin/github/xud/node_modules/sequelize/lib/sequelize.js:554:34)
    at tryCatcher (/Users/admin/github/xud/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/admin/github/xud/node_modules/bluebird/js/release/method.js:39:29)
    at retryParameters (/Users/admin/github/xud/node_modules/sequelize/lib/sequelize.js:454:48)
    at /Users/admin/github/xud/node_modules/retry-as-promised/index.js:39:21
    at Promise._execute (/Users/admin/github/xud/node_modules/bluebird/js/release/debuggability.js:303:9)
    at Promise._resolveFromExecutor (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:79:10)
    at retryAsPromised (/Users/admin/github/xud/node_modules/retry-as-promised/index.js:29:10)
    at Sequelize.query (/Users/admin/github/xud/node_modules/sequelize/lib/sequelize.js:454:12)
    at QueryInterface.update (/Users/admin/github/xud/node_modules/sequelize/lib/query-interface.js:1028:27)
    at Promise.try.then.then.then (/Users/admin/github/xud/node_modules/sequelize/lib/model.js:3691:53)
    at tryCatcher (/Users/admin/github/xud/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/admin/github/xud/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/admin/github/xud/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/admin/github/xud/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/admin/github/xud/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:693:18)
    at tryOnImmediate (timers.js:664:5)
    at processImmediate (timers.js:646:5)

> xud@1.0.0-prealpha.3 test:p2p /Users/admin/github/xud
> mocha -r ts-node/register test/p2p/*

  P2P Sanity Tests
9/14/2018, 10:32:09 AM [GLOBAL][2] warn: RPC server is disabled.
9/14/2018, 10:32:09 AM [P2P][2] warn: Could not verify reachability of advertised address: localhost:0
9/14/2018, 10:32:09 AM [GLOBAL][1] warn: RPC server is disabled.
9/14/2018, 10:32:09 AM [P2P][1] warn: Could not verify reachability of advertised address: localhost:0
    ✓ should connect successfully
    ✓ should fail connecting to the same node
    ✓ should disconnect successfully
9/14/2018, 10:32:09 AM [P2P][1] warn: error while opening connection to peer (thewrongpubkey): node at localhost:65402 sent pub key 024103e740c165e3ef35c8ac3fa6b7defdd71d332a88cef41a7f3b8be8113d073f, expected thewrongpubkey
    ✓ should fail when connecting to an unexpected node pub key
9/14/2018, 10:32:09 AM [P2P][2] error: peer error (03adf05f159d69975655619e34f491dbc0543ffe01d564b2c90b0cda0a8807d632): write EPIPE
9/14/2018, 10:32:09 AM [P2P][2] warn: Peer 03adf05f159d69975655619e34f491dbc0543ffe01d564b2c90b0cda0a8807d632 socket closed due to error
9/14/2018, 10:32:09 AM [P2P][1] warn: cannot attempt connection to self
    ✓ should fail when connecting to self
9/14/2018, 10:32:09 AM [P2P][1] warn: error while opening connection to peer (notarealnodepubkey): could not connect to peer at localhost:9003: connect ECONNREFUSED 127.0.0.1:9003
    ✓ should fail connecting to a non-existing node

  6 passing (270ms)

Not sure why these nodes are not available, why we try to connect them in test, and why failure does not fail the test.

To be checked

sangaman commented 6 years ago

I haven't seen this, and I wonder if it's possibly the result of some bad data in the xud_test database. Was this test run using the recently merged sqlite migration? That ensures that there is no stale data in databases used for tests.

offerm commented 6 years ago

not using the databases anymore. using the latest master.

kilrau commented 6 years ago

can you verify this is still happening? @offerm

offerm commented 6 years ago

Don't see this problem any more. I do see some errors but the tests are passing.

for example:

  P2P Sanity Tests
10/28/2018, 1:05:26 PM [LND][2] error: could not find lnd macaroon, is lnd installed?
10/28/2018, 1:05:26 PM [LND][1] error: could not find lnd macaroon, is lnd installed?
10/28/2018, 1:05:26 PM [GLOBAL][2] warn: RPC server is disabled.
10/28/2018, 1:05:26 PM [GLOBAL][1] warn: RPC server is disabled.
10/28/2018, 1:05:26 PM [P2P][2] warn: Could not verify reachability of advertised address: localhost:0
10/28/2018, 1:05:26 PM [P2P][1] warn: Could not verify reachability of advertised address: localhost:0
    ✓ should connect successfully

These errors are marked with red.

note: If I execute the tests when the setup is active (btcd, ltcd, lndx2, xud all running and connected) I get errors. If I stop XUD (leaving the other 4 processes running) and run the tests all is good.

@kilrau please consider if we should close it or handle it.

sangaman commented 6 years ago

It's a matter of preference I think. The errors are deliberate and expected. It would be easy to silence all errors, but the output might be nice to have for diagnosing unexpected errors. But I don't think it's a big deal, I'd you think the output should be silenced we can do that.

kilrau commented 6 years ago

I think we can leave the output (to catch unexpected things inf future), but not handle it for now