ChainSafe / ChainSafe/gossamer

tests: review/refactor existing test helping functions

Open
#2,336 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Task summary

Most of our unit and integration tests use test helping functions to setup things. This is fine for some integration tests, but it really does feel like it's over-used.

It also allows to justify using `gomock.Any()` and `.AnyTimes()` for mocks, which both reduce testing depth.

This task should aim at reducing their usage or make these helping functions more configurable.

Notable helping functions that might be too permissive:

- `dot/network`: `createTestService`
- `dot/rpc/modules`: `NewMockStorageAPI`
- `dot/rpc/modules`: `NewMockBlockAPI`
- `dot/rpc/modules`: `NewMockCoreAPI`
- `dot/rpc/modules`: `NewMockTransactionStateAPI`
- `dot/rpc/modules`: `NewMockVersion`
- `dot/sync`: `newTestChainSync`
- `dot/sync`: `newMockFinalityGadget`
- `dot/sync`: `newMockBabeVerifier`
- `dot/sync`: `newMockNetwork`
- `lib/runtime`: `newMemoryMock`
- `lib/runtime/wasmer`: `newTransactionStateMock`

Related to #2343

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.