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

yarn test:unit fails with node v18.17.0 #6487

Closed
HiroyukiNaito opened this issue Feb 27, 2024 · 4 comments
Closed

yarn test:unit fails with node v18.17.0 #6487

HiroyukiNaito opened this issue Feb 27, 2024 · 4 comments
Labels
meta-bug Issues that identify a bug and require a fix.

Comments

@HiroyukiNaito
Copy link
Contributor

HiroyukiNaito commented Feb 27, 2024

Describe the bug

Environment

  • yarn version: 1.22.21
  • node version: v18.17.0
  • Ubuntu 22.04.4 LTS /WSL Environment

Reproduction

Fail with Error messages after the following commands

$ yarn 
$ yarn build
$ yarn test:unit

Error Message

@lodestar/beacon-node:  ✓ test/unit/network/peers/client.test.ts  (6 tests) 6ms
@lodestar/beacon-node:  ✓ test/unit/chain/stateCache/stateContextCache.test.ts  (2 tests) 212ms
@lodestar/beacon-node:  ✓ test/unit/eth1/utils/eth1DepositEvent.test.ts  (5 tests) 12ms
@lodestar/beacon-node:  ✓ test/unit/util/wrapError.test.ts  (2 tests) 11ms
@lodestar/beacon-node:  ✓ test/unit/util/graffiti.test.ts  (3 tests) 7ms
@lodestar/beacon-node:  ✓ test/unit/util/shuffle.test.ts  (1 test) 10ms
@lodestar/beacon-node:  ✓ test/unit/chain/bls/utils.test.ts  (8 tests) 12ms
@lodestar/beacon-node:  ❯ test/unit/util/bufferPool.test.ts  (2 tests | 2 failed) 20ms
@lodestar/beacon-node:    ❯ test/unit/util/bufferPool.test.ts > BufferPool > should increase length
@lodestar/beacon-node:      → Object not disposable
@lodestar/beacon-node:    ❯ test/unit/util/bufferPool.test.ts > BufferPool > should not allow alloc if in use
@lodestar/beacon-node:      → Expected non-null mem
@lodestar/beacon-node:  ✓ test/unit/util/time.test.ts  (8 tests) 9ms
@lodestar/beacon-node:  ✓ test/unit/db/buckets.test.ts  (1 test) 5ms
@lodestar/beacon-node:  ✓ test/unit/util/address.test.ts  (2 tests) 5ms
@lodestar/beacon-node:  ✓ test/unit/api/impl/validator/utils.test.ts  (1 test) 32ms
@lodestar/beacon-node:  ✓ test/unit/network/metadata.test.ts  (3 tests) 43ms
@lodestar/beacon-node:  ✓ test/unit/metrics/beacon.test.ts  (1 test) 170ms
@lodestar/beacon-node:  ✓ test/unit/eth1/utils/depositContract.test.ts  (1 test) 70ms
@lodestar/beacon-node:  ✓ test/unit/util/peerId.test.ts  (1 test) 8ms
@lodestar/beacon-node:  ✓ test/unit/network/peers/discover.test.ts  (1 test) 7ms
@lodestar/beacon-node:  ✓ test/unit/api/impl/swaggerUI.test.ts  (1 test) 16ms
@lodestar/beacon-node: stdout | test/unit/metrics/server/http.test.ts > HttpMetricsServer > should serve metrics on /metrics
@lodestar/beacon-node: Feb-27 19:58:54.711[]                 info: Started metrics HTTP server address=http://[::]:14500
@lodestar/beacon-node:  ✓ test/unit/metrics/server/http.test.ts  (1 test) 219ms
@lodestar/beacon-node:  ✓ test/unit/metrics/metrics.test.ts  (1 test) 43ms
@lodestar/beacon-node:  ✓ test/unit/api/impl/validator/produceAttestationData.test.ts  (2 tests) 24ms
@lodestar/beacon-node:  ✓ test/unit/api/impl/beacon/beacon.test.ts  (1 test) 15ms
@lodestar/beacon-node:  ✓ test/unit/chain/rewards/blockRewards.test.ts  (6 tests) 36189ms
@lodestar/beacon-node: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯
@lodestar/beacon-node:  FAIL  test/unit/util/bufferPool.test.ts > BufferPool > should increase length
@lodestar/beacon-node: TypeError: Object not disposable
@lodestar/beacon-node:  ❯ __using test/unit/util/bufferPool.test.ts:17:13
@lodestar/beacon-node:      16|   it("should not allow alloc if in use", () => {
@lodestar/beacon-node:      17|     {
@lodestar/beacon-node:      18|       using mem = pool.alloc(20);
@lodestar/beacon-node:        |       ^
@lodestar/beacon-node:      19|       if (mem === null) {
@lodestar/beacon-node:      20|         throw Error("Expected non-null mem");
@lodestar/beacon-node:  ❯ test/unit/util/bufferPool.test.ts:9:17
@lodestar/beacon-node: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯
@lodestar/beacon-node:  FAIL  test/unit/util/bufferPool.test.ts > BufferPool > should not allow alloc if in use
@lodestar/beacon-node: Error: Expected non-null mem
@lodestar/beacon-node:  ❯ test/unit/util/bufferPool.test.ts:20:15
@lodestar/beacon-node:      18|       using mem = pool.alloc(20);
@lodestar/beacon-node:      19|       if (mem === null) {
@lodestar/beacon-node:      20|         throw Error("Expected non-null mem");
@lodestar/beacon-node:        |               ^
@lodestar/beacon-node:      21|       }
@lodestar/beacon-node:      22|       // in the same scope we can't allocate again
@lodestar/beacon-node: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/2]⎯
@lodestar/beacon-node:  Test Files  1 failed | 121 passed | 2 skipped (124)
@lodestar/beacon-node:       Tests  2 failed | 953 passed | 12 skipped (967)
@lodestar/beacon-node:    Start at  19:58:18
@lodestar/beacon-node:    Duration  46.17s (transform 16.66s, setup 8.73s, collect 224.76s, tests 55.90s, environment 57ms, prepare 33.66s)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@lodestar/beacon-node: error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  Lerna (powered by Nx)   Running target test:unit for 17 projects failed

   Tasks not run because their dependencies failed or --nx-bail=true:

   - @chainsafe/lodestar:test:unit
   - @lodestar/flare:test:unit
   - @lodestar/prover:test:unit
   - @lodestar/spec-test-util:test:unit

   Failed tasks:

   - @lodestar/beacon-node:test:unit

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

Tests should end with succeed and no error happens

Steps to reproduce

Environment

  • yarn version: 1.22.21
  • node version: v18.17.0
  • Ubuntu 22.04.4 LTS /WSL Environment

Reproduction

Fail with Error messages after the following commands

$ yarn 
$ yarn build
$ yarn test:unit

Additional context

After updating Node to v20.11.1. The unit tests successfully ended.

Operating system

Linux

Lodestar version or commit hash

f62bc13

@HiroyukiNaito HiroyukiNaito added the meta-bug Issues that identify a bug and require a fix. label Feb 27, 2024
@HiroyukiNaito
Copy link
Contributor Author

HiroyukiNaito commented Feb 27, 2024

package.json should be updated.

https://github.com/ChainSafe/lodestar/blob/unstable/package.json#L5

@HiroyukiNaito HiroyukiNaito changed the title 'yarn test:unit' fails with node 'v18.17.0 ' yarn test:unit fails with node v18.17.0 Feb 27, 2024
@nflaig
Copy link
Member

nflaig commented Feb 28, 2024

Thanks for reporting @HiroyukiNaito

It turns out that we introduced the using keyword in our tests in #6269.

I was able to confirm that this is not supported in node v18.17.0 but it seems to work fine with v18.19.1 (latest node 18 version).

@nflaig
Copy link
Member

nflaig commented Feb 28, 2024

package.json should be updated.

https://github.com/ChainSafe/lodestar/blob/unstable/package.json#L5

@HiroyukiNaito
Copy link
Contributor Author

@nflaig Thanks. I close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta-bug Issues that identify a bug and require a fix.
Projects
None yet
Development

No branches or pull requests

2 participants