cosmos / cosmos/interchain-security

Improve error handling in TestKeyAssignment

Open
#2,337 0 comments 0 reactions 0 assignees View on GitHub
status: waiting-triage
Dominant language
Go
Stars
195
Forks
166
PR merge metrics
No merged PRs in 30d

Description

## Problem

The integration test TestKeyAssignment in [key_assignment.go](https://github.com/cosmos/interchain-security/blob/ph/test-table/tests/integration/key_assignment.go#L35C1-L35C2) has several test cases that use early returns on errors.
Since some test cases *expect* errors but don't check error types, this means that the tests would fail silently if errors are returned in places other than where the *actual* expected error is.

## Problem details

The following test cases have early returns on errors, which can lead to false positive test results:
- Double same-key assignment in the same block by different values
- Double same-key assignment in the same block by the same value
- Double same-key assignment in different blocks by different values

As a temporary solution, the test cases should panic in the event of an early error. These test cases need to be refactored to use proper error handling and ensure all checks are performed correctly.

An alternative solution could be to add checks for the exact error types or messages.

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.