Skip to content

headertest: unify TestSuite constructors behind functional options - #5041

Merged
vgonkivs merged 4 commits into
celestiaorg:mainfrom
pjdurden:headertest/unify-constructors
Jun 11, 2026
Merged

headertest: unify TestSuite constructors behind functional options#5041
vgonkivs merged 4 commits into
celestiaorg:mainfrom
pjdurden:headertest/unify-constructors

Conversation

@pjdurden

@pjdurden pjdurden commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Closes #4037.

Unifies the four TestSuite constructors (NewTestSuite, NewTestSuiteWithGenesisTime, NewTestSuiteDefaults, NewTestSuiteWithTail) into a single variadic NewTestSuite(t, ...Option) with WithValidators, WithBlockTime, WithStartTime and WithTail, and migrates all call sites.

The migration is behavior-preserving — block-time spacing is retained at the call sites where the removed constructors set it to keep generated header timestamps monotonic. Voting power is standardized (it does not affect test outcomes since every validator signs each commit).

Verified: header/headertest, pruner, core, das and share/availability/full tests pass.

Collapse NewTestSuite, NewTestSuiteWithGenesisTime, NewTestSuiteDefaults and
NewTestSuiteWithTail into a single variadic NewTestSuite(t, ...Option) with
WithValidators, WithBlockTime, WithStartTime and WithTail, and migrate all
call sites. Behavior is preserved (e.g. block-time spacing is kept where the
old constructors relied on it for monotonic timestamps).

Closes celestiaorg#4037
Copilot AI review requested due to automatic review settings June 7, 2026 21:49
@pjdurden
pjdurden requested a review from a team as a code owner June 7, 2026 21:49
@pjdurden
pjdurden requested a review from rach-id June 7, 2026 21:49
@github-actions github-actions Bot added the external Issues created by non node team members label Jun 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Refactors the header/headertest NewTestSuite API from positional parameters / multiple constructors to an options-based configuration, and updates call sites accordingly.

Changes:

  • Introduces Option pattern for headertest.NewTestSuite (e.g., WithValidators, WithBlockTime, WithStartTime, WithTail) and removes older helper constructors.
  • Updates multiple tests to use the new options-based API.
  • Aligns some tests to explicitly set validator count and/or block time via options.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
share/availability/full/availability_test.go Updates NewTestSuite usage to options-based configuration.
pruner/service_test.go Updates suite construction to explicitly set validators and block time.
header/headertest/verify_test.go Updates verifier tests to use WithValidators option.
header/headertest/testing.go Introduces options-based NewTestSuite and removes older constructors/default helpers.
das/daser_test.go Replaces removed default/tail constructors with options-based NewTestSuite.
core/routing_exchange_test.go Replaces removed defaults constructor with options-based NewTestSuite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread header/headertest/testing.go
Comment thread das/daser_test.go Outdated
Comment thread core/routing_exchange_test.go Outdated
Address review: replace the unclear WithBlockTime(1) literal (1ns) with
the explicit time.Nanosecond in the migrated call sites.
@rach-id
rach-id requested review from vgonkivs and removed request for rach-id June 8, 2026 11:10
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.36842% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.60%. Comparing base (2469e7a) to head (220a69e).
⚠️ Report is 813 commits behind head on main.

Files with missing lines Patch % Lines
header/headertest/testing.go 47.36% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5041      +/-   ##
==========================================
- Coverage   44.83%   36.60%   -8.24%     
==========================================
  Files         265      311      +46     
  Lines       14620    21505    +6885     
==========================================
+ Hits         6555     7871    +1316     
- Misses       7313    12627    +5314     
- Partials      752     1007     +255     

☔ View full report in Codecov by Harness.
📢 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.

@vgonkivs
vgonkivs added this pull request to the merge queue Jun 11, 2026
Merged via the queue into celestiaorg:main with commit fceaa85 Jun 11, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Issues created by non node team members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

headertest: Consider unifying constructors for header generation and adding opts

4 participants