Skip to content

fix(test): fix race on db flaky test#3087

Open
bar-bera wants to merge 5 commits intomainfrom
bar/fix-db-test-race
Open

fix(test): fix race on db flaky test#3087
bar-bera wants to merge 5 commits intomainfrom
bar/fix-db-test-race

Conversation

@bar-bera
Copy link
Copy Markdown
Collaborator

@bar-bera bar-bera commented Apr 21, 2026

Fixes this failing pipeline:

https://github.com/berachain/beacon-kit/actions/runs/24676377991/job/72161386938?pr=3086

TestRangeDB_Invariants/Prune_from_populated failing with "Index 1 should have been pruned" because of test isolation breakage

@bar-bera bar-bera requested a review from a team as a code owner April 21, 2026 10:21
Copilot AI review requested due to automatic review settings April 21, 2026 10:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the file-backed DB constructor and related tests to address a flaky/racy pipeline failure in storage/filedb by changing filesystem initialization behavior and updating tests/helpers.

Changes:

  • Make NewDB respect an injected afero.Fs (only default to OS FS when none is provided).
  • Update several DB error-path tests to stop injecting an in-memory FS.
  • Fix typo in lastConsequetiveNilIndex helper name in RangeDB tests.

Reviewed changes

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

File Description
storage/filedb/db.go Makes default filesystem initialization conditional on db.fs being unset.
storage/filedb/db_test.go Updates error-case tests to rely on OS filesystem behavior under /etc.
storage/filedb/range_db_test.go Renames a helper to correct spelling (ConsequetiveConsecutive).

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

Comment thread storage/filedb/db.go
Comment thread storage/filedb/db_test.go
Comment thread storage/filedb/db_test.go
Comment thread storage/filedb/db_test.go
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.43%. Comparing base (a70a4f3) to head (e19f0db).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3087   +/-   ##
=======================================
  Coverage   60.42%   60.43%           
=======================================
  Files         367      367           
  Lines       18694    18697    +3     
=======================================
+ Hits        11296    11299    +3     
  Misses       6454     6454           
  Partials      944      944           
Files with missing lines Coverage Δ
storage/filedb/db.go 93.47% <100.00%> (+0.45%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@calbera calbera left a comment

Choose a reason for hiding this comment

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

utACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants