Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Utils: Delegate Unit test fails at random #859

Closed
slaweet opened this issue Oct 12, 2017 · 0 comments
Closed

Utils: Delegate Unit test fails at random #859

slaweet opened this issue Oct 12, 2017 · 0 comments

Comments

@slaweet
Copy link
Contributor

slaweet commented Oct 12, 2017

Expected behaviour

Utils: Delegate should return requestToActivePeer(activePeer, 'delegates/search', options) if options.q is set should always pass

Actual behaviour

This sometimes fails:
https://github.com/LiskHQ/lisk-nano/blob/8bc1ac24ab145051cafa9017dbfb63d3c24c83d8/src/utils/api/delegate.test.js#L48-L57

For example here: https://jenkins.lisk.io/job/lisk-nano/job/development/46/console

With this error:

FAILED TESTS:
  Utils: Delegate
    ✖ "after each" hook for "should return requestToActivePeer(activePeer, `delegates/search`, options) if options.q is set"
      HeadlessChrome 0.0.0 (Linux 0.0.0)
    Unexpected call: requestToActivePeer([LiskAPI] {
      bannedPeers: [],
      currentPeer: "testnet.lisk.io",
      defaultPeers: ["node01.lisk.io", "node02.lisk.io", "node03.lisk.io", "node04.lisk.io", "node05.lisk.io", "node06.lisk.io", "node07.lisk.io", "node08.lisk.io"],
      defaultSSLPeers: [Circular],
      defaultTestnetPeers: ["testnet.lisk.io"],
      nethash: {
        Content-Type: "application/json",
        broadhash: "da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba",
        minVersion: ">=0.5.0",
        nethash: "198f2b61a8eb95fbeed58b8216780b68f697f26b849acf00c8c93bb9b24f783d",
        os: "lisk-js-api",
        port: 7000,
        version: "0.0.0a"
      },
      options: {
        address: "http://localhost:4000",
        custom: true,
        name: "Custom Node",
        nethash: "198f2b61a8eb95fbeed58b8216780b68f697f26b849acf00c8c93bb9b24f783d",
        testnet: true
      },
      parseOfflineRequests: function ParseOfflineRequest() {},
      port: 7000,
      randomPeer: true,
      ssl: false,
      testnet: true
    }, delegates/get, { publicKey: "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f" }) at getDelegate (webpack:///src/utils/api/delegate.js:11:22 <- src/tests.js:284737:41)
    Expectation met: requestToActivePeer({  }, delegates/search, { q: "genesis_1" }[, ...]) once
    ExpectationError: Unexpected call: requestToActivePeer([LiskAPI] {
      bannedPeers: [],
      currentPeer: "testnet.lisk.io",
      defaultPeers: ["node01.lisk.io", "node02.lisk.io", "node03.lisk.io", "node04.lisk.io", "node05.lisk.io", "node06.lisk.io", "node07.lisk.io", "node08.lisk.io"],
      defaultSSLPeers: [Circular],
      defaultTestnetPeers: ["testnet.lisk.io"],
      nethash: {
        Content-Type: "application/json",
        broadhash: "da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba",
        minVersion: ">=0.5.0",
        nethash: "198f2b61a8eb95fbeed58b8216780b68f697f26b849acf00c8c93bb9b24f783d",
        os: "lisk-js-api",
        port: 7000,
        version: "0.0.0a"
      },
      options: {
        address: "http://localhost:4000",
        custom: true,
        name: "Custom Node",
        nethash: "198f2b61a8eb95fbeed58b8216780b68f697f26b849acf00c8c93bb9b24f783d",
        testnet: true
      },
      parseOfflineRequests: function ParseOfflineRequest() {},
      port: 7000,
      randomPeer: true,
      ssl: false,
      testnet: true
    }, delegates/get, { publicKey: "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f" }) at getDelegate (webpack:///src/utils/api/delegate.js:11:22 <- src/tests.js:284737:41)
    Expectation met: requestToActivePeer({  }, delegates/search, { q: "genesis_1" }[, ...]) once
        at Object.fail (webpack:///node_modules/sinon/lib/sinon/mock-expectation.js:281:0 <- src/tests.js:212844:25)
        at Object.verify (webpack:///node_modules/sinon/lib/sinon/mock.js:108:0 <- src/tests.js:212967:29)
        at Context.<anonymous> (webpack:///src/utils/api/delegate.test.js:27:14 <- src/tests.js:284868:15)

Steps to reproduce

Run unit tests many times until it happens ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants