Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace pokemon.random with Math.random to avoid value collision #2564

Merged
merged 2 commits into from May 10, 2019

Conversation

Projects
None yet
3 participants
@faustbrian
Copy link
Collaborator

commented May 10, 2019

Summary

Tests that rely on multiple delegate registrations will randomly fail because there is a high probability of the same value ending up in the list of names.

 FAIL  __tests__/integration/core-transaction-pool/processor.test.ts (19.668s)
  ● Transaction Guard › validate › Sign a transaction then change some fields shouldn't pass validation › should not validate when changing fields after signing - delegate registration

    expect(received).toEqual(expected) // deep equality

    - Expected
    + Received

    @@ -1,10 +1,10 @@
      Array [
        Array [
          "b0ef0260e5011b8d451fb57a1c495febadfa8b6412146733de4359d4acaaa658",
    -     "ERR_BAD_DATA",
    -     "Transaction didn't pass the verification process.",
    +     "ERR_CONFLICT",
    +     "Multiple delegate registrations for \"ferroseed\" in transaction payload",
        ],
        Array [
          "90d938f7e7f2634ff34613da9045ad05e07fa83ba8885c5f3c5661c9ebe8375d",
          "ERR_BAD_DATA",
          "Transaction didn't pass the verification process.",
    @@ -14,12 +14,12 @@
          "ERR_BAD_DATA",
          "Transaction didn't pass the verification process.",
        ],
        Array [
          "92bd3ff4bfa7f53ce91427ea585dafca7f232f4cb846d6b11bc603172ba431de",
    -     "ERR_BAD_DATA",
    -     "Transaction didn't pass the verification process.",
    +     "ERR_CONFLICT",
    +     "Multiple delegate registrations for \"ferroseed\" in transaction payload",
        ],
        Array [
          "cd09afe78a8a230c096f672da3c024c44590c3da088481d10f8286e6217f0b0d",
          "ERR_BAD_DATA",
          "Transaction didn't pass the verification process.",

      621 |                 expect(
      622 |                     Object.keys(result.errors).map(id => [id, result.errors[id][0].type, result.errors[id][0].message]),
    > 623 |                 ).toEqual(expectedErrors);
          |                   ^
      624 |                 expect(result.invalid).toEqual(modifiedTransactions.map(transaction => transaction.id));
      625 |                 expect(result.accept).toEqual([]);
      626 |                 expect(result.broadcast).toEqual([]);

      at Object.it (__tests__/integration/core-transaction-pool/processor.test.ts:623:19)

What kind of change does this PR introduce?

  • Bugfix
  • New feature
  • Refactoring / Performance Improvements
  • Build-related changes
  • Documentation
  • Tests / Continuous Integration
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR release a new version?

  • Yes
    • All tests are passing
    • All benchmarks are passing without any major regressions
    • Sync from 0 works on mainnet
    • Sync from 0 works on devnet
    • Starting a new network and forging on it work
    • Explorer is fully functional
    • Wallets are fully functional
  • No

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

commented May 10, 2019

The ci/circleci: test-node11-functional job is failing as of 4ee664b1186ad8e28b377a75b4054c0d9483acb2. Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@codecov-io

This comment has been minimized.

Copy link

commented May 10, 2019

Codecov Report

Merging #2564 into develop will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2564      +/-   ##
===========================================
- Coverage    67.15%   67.14%   -0.01%     
===========================================
  Files          403      403              
  Lines         8825     8824       -1     
  Branches       454      416      -38     
===========================================
- Hits          5926     5925       -1     
- Misses        2844     2846       +2     
+ Partials        55       53       -2
Impacted Files Coverage Δ
...ter-cli/src/commands/send/delegate-registration.ts 58.33% <100%> (-1.67%) ⬇️
packages/core-logger-winston/src/formatter.ts 41.66% <0%> (ø) ⬆️
...es/core-blockchain/src/replay/replay-blockchain.ts 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 093e4c0...53acda1. Read the comment docs.

@faustbrian faustbrian merged commit 7dcfaf4 into develop May 10, 2019

12 checks passed

ci/circleci: test-node10-benchmark Your tests passed on CircleCI!
Details
ci/circleci: test-node10-e2e Your tests passed on CircleCI!
Details
ci/circleci: test-node10-functional Your tests passed on CircleCI!
Details
ci/circleci: test-node10-integration-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-integration-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-unit Your tests passed on CircleCI!
Details
ci/circleci: test-node11-benchmark Your tests passed on CircleCI!
Details
ci/circleci: test-node11-e2e Your tests passed on CircleCI!
Details
ci/circleci: test-node11-functional Your tests passed on CircleCI!
Details
ci/circleci: test-node11-integration-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-integration-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-unit Your tests passed on CircleCI!
Details

@ArkEcosystemBot ArkEcosystemBot deleted the fix/random branch May 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.