Skip to content

test: Unit tests for Tendermint driver - #2786

Merged
infrmtcs merged 3 commits into
mainfrom
dat/driver
May 9, 2025
Merged

infrmtcs merged 3 commits into
mainfrom
dat/driver

Conversation

@infrmtcs

@infrmtcs infrmtcs commented Apr 25, 2025 •

Copy link
Copy Markdown
Contributor

This PR consists of 2 commits:

First commit

Although the number of changes is big, the changes are minor:

  • Move the Driver struct and its functions to a separate driver package. The tests are added in the next PR.
  • Rename Tendermint struct to stateMachine and add StateMachine interface to list the exported functions from stateMachine.
  • Rename timeout, step, height, round and votingPower to Timeout, Step, Height, Round and VotingPower to be able to use in driver package.
  • Rename propose, prevote and precommit steps to StepPropose, StepPrevote and StepPrecommit. The Step prefix is to differentiate with the message types.

Second commit:

This add unit tests for driver package, using a mock stateMachine. The reason why mock is used here is:

  • The behaviour of every rule in the core algorithm is covered by the tests in tendermint package.
  • The expected consensus that a cluster of nodes should reach will be covered by integ tests, in PR test: Integration tests for cluster of Tendermint drivers #2790.
  • The tests in this PR mainly to ensure that the broadcasted message returned by actions will be sent, the timeout will be scheduled and the driver will forward all received messages to the state machine.

@codecov

codecov Bot commented Apr 25, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 97.20670% with 5 lines in your changes missing coverage. Please review.

Project coverage is 75.76%. Comparing base (4592cd5) to head (1300410).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
consensus/driver/driver.go 92.85% 3 Missing and 1 partial ⚠️
consensus/tendermint/tendermint.go 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2786      +/-   ##
==========================================
+ Coverage   75.34%   75.76%   +0.42%     
==========================================
  Files         171      173       +2     
  Lines       19928    19962      +34     
==========================================
+ Hits        15014    15124     +110     
+ Misses       3971     3895      -76     
  Partials      943      943              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@infrmtcs
infrmtcs requested a review from rianhughes April 28, 2025 08:36
@infrmtcs infrmtcs linked an issue Apr 28, 2025 that may be closed by this pull request
@infrmtcs
infrmtcs force-pushed the dat/driver branch 2 times, most recently from 75931b3 to 2ecbef4 Compare April 30, 2025 07:35
@infrmtcs
infrmtcs force-pushed the dat/driver branch 2 times, most recently from a05f563 to 6830be2 Compare May 2, 2025 07:39
@infrmtcs
infrmtcs marked this pull request as ready for review May 3, 2025 05:45
@infrmtcs
infrmtcs requested a review from rodrodros May 5, 2025 09:21
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver_test.go Outdated
Comment thread consensus/driver/driver.go
Comment thread consensus/driver/driver.go
@rianhughes

Copy link
Copy Markdown
Contributor

LGTM up to the above comments

@infrmtcs
infrmtcs merged commit 597b511 into main May 9, 2025
@infrmtcs
infrmtcs deleted the dat/driver branch May 9, 2025 10:38

This branch was previously deployed

1 inactive deployment
Development — 1300410a Deployed May 9, 2025 by infrmtcs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tendermint] Unit tests for driver

3 participants