-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
Overview
- You can run the shared validator locally:
./scripts/start-shared-test-validator.sh - If you do this then the unit tests for eg rpc-core will use this validator
- This is useful for being able to make RPC calls manually while creating tests
- Over time the
validator.logwill fill up - And eventually a test that tries to read the whole file will start failing
Steps to reproduce
- Run the shared validator locally:
./scripts/start-shared-test-validator.sh - A few hours later, in
packages/rpc-core, runpnpm test:unit:node
Description of bug
The genesis hash test fails:
Summary of all failing tests
FAIL src/rpc-methods/__tests__/get-genesis-hash-test.ts
● getGenesisHash › when sent to a local validator › returns the genesis hash
RangeError: File size (5599667301) is greater than 2 GiB
24 | it('returns the genesis hash', async () => {
25 | expect.assertions(1);
> 26 | const logFile = fs.readFileSync(logFilePath, 'utf-8');
| ^
27 | const expectedGenesisHash = logFile.match(genesisHashPattern)?.[1];
28 | const genesisHashPromise = rpc.getGenesisHash().send();
29 | await expect(genesisHashPromise).resolves.toBe(expectedGenesisHash);
at Object.readFileSync (src/rpc-methods/__tests__/get-genesis-hash-test.ts:26:32)
● getGenesisHash › when sent to a local validator › returns the genesis hash
expect.assertions(1)
Expected one assertion to be called but received zero assertion calls.
23 | describe('when sent to a local validator', () => {
24 | it('returns the genesis hash', async () => {
> 25 | expect.assertions(1);
| ^
26 | const logFile = fs.readFileSync(logFilePath, 'utf-8');
27 | const expectedGenesisHash = logFile.match(genesisHashPattern)?.[1];
28 | const genesisHashPromise = rpc.getGenesisHash().send();
at Object.assertions (src/rpc-methods/__tests__/get-genesis-hash-test.ts:25:20)
Test Suites: 1 failed, 50 passed, 51 total
Tests: 1 failed, 66 todo, 260 passed, 327 total
Snapshots: 0 total
Time: 2.419 s
We'll need to find a different way to find the genesis hash pattern in validator.log without loading the whole file into memory.
This will probably always be fine in CI because the validator has just started, but locally it's useful to be able to keep a long-running test validator up and run the test suite against it.
buffalojoec