Skip to content

Document and Resolve all Flaky Tests #1771

Open
@fuxingloh

Description

@fuxingloh

What would you like to be added:

As per the title, documenting and resolving all flaky test cases.

/area packages apps
/triage accepted

Flaky Tests:

  • FAIL apps/playground-api/tests/modules/PlaygroundModule.test.ts (113.96 s)
FAIL apps/playground-api/__tests__/modules/PlaygroundModule.test.ts (113.96 s)
  ● should have gov set

    expect(received).rejects.toThrow(expected)

    Expected substring: "Payback of loan via DUSD token is not currently active"
    Received message:   "RpcApiError: 'Test PaybackLoanTx execution failed:
    Cannot payback loan while any of the asset's price is invalid', code: -32600, method: paybackloan"

          89 |
          90 |     if (error != null) {
        > 91 |       throw new RpcApiError({
             |             ^
          92 |         ...error,
          93 |         method: method
          94 |       })

      at Function.parse (packages/jellyfish-api-jsonrpc/src/index.ts:91:13)
      at TestingJsonRpcClient.call (packages/jellyfish-api-jsonrpc/src/index.ts:69:30)
                at runMicrotasks (<anonymous>)
      at Loan.paybackLoan (packages/jellyfish-api-core/src/category/loan.ts:267:12)
      at Object.<anonymous> (apps/playground-api/__tests__/modules/PlaygroundModule.test.ts:297:3)
      at Object.toThrow (node_modules/expect/build/index.js:285:22)
      at Object.<anonymous> (apps/playground-api/__tests__/modules/PlaygroundModule.test.ts:297:33)
          at runMicrotasks (<anonymous>)
  • FAIL packages/jellyfish-transaction-builder/tests/txn/txn_builder_loan_payback_loan.test.ts (366.098 s)
FAIL packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_payback_loan.test.ts (366.098 s)
  ● paybackLoan success › should paybackLoan by anyone

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

    Expected: "0.00006850"
    Received: "0.00004567"

      448 |     const tslaInterestTotal = tslaInterestsPerBlockBefore.multipliedBy(height - tslaLoanHeight + 1)
      449 |     expect(interestsBeforePayback[0].interestPerBlock.toFixed(8)).toStrictEqual(tslaInterestsPerBlockBefore.toFixed(8, BigNumber.ROUND_CEIL))
    > 450 |     expect(interestsBeforePayback[0].totalInterest.toFixed(8)).toStrictEqual(tslaInterestTotal.toFixed(8, BigNumber.ROUND_CEIL))
          |                                                                ^
      451 |
      452 |     const tslaLoanAmountBefore = new BigNumber(40).plus(tslaInterestTotal).decimalPlaces(8, BigNumber.ROUND_CEIL)
      453 |     const tslaLoanValueBefore = tslaLoanAmountBefore.multipliedBy(2)

      at Object.<anonymous> (packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_payback_loan.test.ts:450:64)
          at runMicrotasks (<anonymous>)
  • FAIL packages/jellyfish-api-core/tests/category/account/getPendingFutureSwaps.test.ts (117.119 s)
FAIL packages/jellyfish-api-core/__tests__/category/account/getPendingFutureSwaps.test.ts (117.119 s)
  ● Account GetPendingFutureSwaps › Single futureswap › If GOV attributes: token is disabled after futureswap › Should getPendingFutureSwaps if futureswap DUSD for TSLA

    RpcApiError: 'Test SetGovVariableTx execution failed:
    tx not from foundation member', code: -32600, method: setgov

      89 |
      90 |     if (error != null) {
    > 91 |       throw new RpcApiError({
         |             ^
      92 |         ...error,
      93 |         method: method
      94 |       })

      at Function.parse (packages/jellyfish-api-jsonrpc/src/index.ts:91:13)
      at TestingJsonRpcClient.call (packages/jellyfish-api-jsonrpc/src/index.ts:69:30)
          at runMicrotasks (<anonymous>)
      at Masternode.setGov (packages/jellyfish-api-core/src/category/masternode.ts:177:12)
      at setup (packages/jellyfish-api-core/__tests__/category/account/getPendingFutureSwaps.test.ts:126:5)
      at Object.<anonymous> (packages/jellyfish-api-core/__tests__/category/account/getPendingFutureSwaps.test.ts:144:5)
  • FAIL packages/jellyfish-api-core/tests/category/loan/placeAuctionBid.test.ts (247.409 s)
FAIL packages/jellyfish-api-core/__tests__/category/loan/placeAuctionBid.test.ts (247.409 s)
  ● placeAuctionBid success › should placeAuctionBid with utxos

    RpcApiError: 'Insufficient funds', code: -4, method: placeauctionbid
  • FAIL packages/jellyfish-transaction-builder/tests/txn/txn_builder_account_future_swap.test.ts (341.543 s)
FAIL packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_future_swap.test.ts (341.543 s)
  ● withdraw futureswap › should withdraw futureswap dusd to dtoken

    RpcApiError: 'Test SetOracleDataTx execution failed:
    Timestamp (1663829748) is out of price update window (median: 1579045229)', code: -32600, method: setoracledata
  • FAIL packages/jellyfish-api-core/tests/category/loan/withdrawFromVault.test.ts (194.061 s)
FAIL packages/jellyfish-api-core/__tests__/category/loan/withdrawFromVault.test.ts (194.061 s)
  ● withdrawFromVault with 50% DUSD or DFI collaterals › should not takeLoan with 33.33% DUSD collateral

    expect(received).rejects.toThrow(expected)

    Expected substring: "At least 50% of the minimum required collateral must be in DFI or DUSD"
    Received message:   "RpcApiError: 'WithdrawFromVaultTx: Vault does not have enough collateralization ratio defined by loan scheme - 133 < 200 (code 16)', code: -26, method: withdrawfromvault"
  • FAIL packages/jellyfish-wallet-encrypted/tests/scrypt.test.ts (8.208 s)
FAIL packages/jellyfish-wallet-encrypted/__tests__/scrypt.test.ts (8.208 s)
  ● configurable params (easy-hard)

    expect(received).toBeGreaterThan(expected)

    Expected: > 2990
    Received:   2667

      33 |   // significantly slower
      34 |   // technically it is 8x harder, but they can be processed in parallel
    > 35 |   expect(hardTime).toBeGreaterThan(easyTime * 2)
         |                    ^
      36 | })
      37 |

      at Object.<anonymous> (packages/jellyfish-wallet-encrypted/__tests__/scrypt.test.ts:35:20)
  • FAIL apps/playground-api/tests/controllers/WalletController.test.ts (120.766 s)
FAIL apps/playground-api/__tests__/controllers/WalletController.test.ts (120.766 s)
  ● sendUtxo › should send utxo to address and wait for automated block confirmation

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

    Expected: 1
    Received: 0

      31 |     })
      32 |
    > 33 |     expect(unspent.length).toStrictEqual(1)
         |                            ^
      34 |     expect(unspent[0].address).toStrictEqual(address)
      35 |     expect(unspent[0].amount).toStrictEqual(new BigNumber('19.34153143'))
      36 |   })

      at Object.<anonymous> (apps/playground-api/__tests__/controllers/WalletController.test.ts:33:28)
          at runMicrotasks (<anonymous>)
  • FAIL packages/jellyfish-api-core/tests/category/blockchain/getMempoolDescendants.test.ts (28.545 s)
FAIL packages/jellyfish-api-core/__tests__/category/blockchain/getMempoolDescendants.test.ts (28.545 s)
  ● Transactions with descendants › should return array of transaction ids if verbose is false

    expect(received).toBeGreaterThan(expected)

    Expected: > 0
    Received:   0

       95 |     const txIdWithDescendants = await getTxIdWithDescendants()
       96 |     const mempoolDescendants = await testing.rpc.blockchain.getMempoolDescendants(txIdWithDescendants, false)
    >  97 |     expect(mempoolDescendants.length).toBeGreaterThan(0)
          |                                       ^
       98 |     for (const descendantId of mempoolDescendants) {
       99 |       expect(descendantId).toStrictEqual(expect.stringMatching(/^[0-9a-f]{64}$/))
      100 |     }

      at Object.<anonymous> (packages/jellyfish-api-core/__tests__/category/blockchain/getMempoolDescendants.test.ts:97:39)
          at runMicrotasks (<anonymous>)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions