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

tests: Improve stability for tests #292

Open
pedroferreira1 opened this issue Jun 9, 2023 · 0 comments
Open

tests: Improve stability for tests #292

pedroferreira1 opened this issue Jun 9, 2023 · 0 comments
Assignees
Labels

Comments

@pedroferreira1
Copy link
Member

pedroferreira1 commented Jun 9, 2023

Integration tests

Sometimes it's important in the integration tests to wait in the websocket for a transaction that was just sent, so the wallet can update its utxos and balance, in order to continue the test sequence. We are currently using a delay but this is causing some issues because sometimes the delay used is not enough and the test fails intermittently.

There are some solutions for that, one is what was done in the wallet lib, which is to await for a specific transaction to arrive in the websocket before continuing the test sequence. We also have the headless wallet external notification plugins that could be used for that.

Error:

console.log node_modules/winston/lib/winston/transports/console.js:79
      2023-06-19T13:05:05.510Z [wallet] error: Token: 00. Insufficient amount of tokens to fill the amount. { errorCode: 'wallet-error', errorData: null, stack: 'Error: Token: 00. Insufficient amount of tokens to fill the amount.\n    at SendTransaction.<anonymous> (/home/runner/work/hathor-wallet-headless/hathor-wallet-headless/node_modules/@hathor/wallet-lib/src/new/sendTransaction.ts:208:17)\n    at Generator.throw (<anonymous>)\n    at rejected (/home/runner/work/hathor-wallet-headless/hathor-wallet-headless/node_modules/@hathor/wallet-lib/lib/new/sendTransaction.js:12:65)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)' }

  ● send tx (HTR) › Should fail to send a transaction with more than min signatures

    expect(received).toBeTruthy()

    Received: undefined

      247 |
      248 |     const sig1 = await wallet1.getSignatures(txHex);
    > 249 |     expect(sig1).toBeTruthy();
          |                  ^
      250 |     const sig2 = await wallet2.getSignatures(txHex);
      251 |     expect(sig2).toBeTruthy();
      252 |     const sig3 = await wallet3.getSignatures(txHex);

      at Object.<anonymous> (__tests__/integration/multisig.test.js:249:18)
          at runMicrotasks (<anonymous>)

Unit tests

Sometimes the unit tests are hanging because of an open promise.

@pedroferreira1 pedroferreira1 changed the title tests: Improve stability for integration tests tests: Improve stability for tests Jun 12, 2023
@pedroferreira1 pedroferreira1 self-assigned this Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant