ChainSafe / ChainSafe/gossamer
tests: review/refactor existing test helping functions
- 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
Assessment
This issue has not been assessed yet.