Consolidate assert_prefetch_activity_increased and assert_no_prefetch_activity in test_prefetch02.py

XMLWordPrintableJSON

    • Type: Technical Debt
    • Resolution: Fixed
    • Priority: Minor - P4
    • WT12.0.0, 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: Prefetch
    • None
    • Storage Engines, Storage Engines - Persistence
    • 164.593
    • SE Persistence - 2026-05-08
    • None

      Issue Summary

      assert_prefetch_activity_increased and assert_no_prefetch_activity in test/suite/test_prefetch02.py are near-identical: both call get_prefetch_activity_stats and compare all four PrefetchStats fields, differing only in the assertion type (assertGreaterEqual vs assertEqual). This violates DRY and means any future stat addition requires edits in two places.

      Context* File: test/suite/test_prefetch02.py

      • Introduced during the WT-17372 test cleanup (PR #13680 follow-up)
      • Risk: low, but any new field added to PrefetchStats must be added to both assertion helpers, making the duplication a future maintenance trap

      Proposed Solution

      • Merge the two methods into a single assert_prefetch_stats(session, snapshot, exact=False) method
      • Iterate over PrefetchStats._fields and dispatch to assertEqual when exact=True, assertGreaterEqual otherwise
      • Update call sites:
        ** assert_prefetch_activity_increased(session, snapshot) -> assert_prefetch_stats(session, snapshot)
        ** assert_no_prefetch_activity(session) -> assert_prefetch_stats(session, PrefetchStats(0, 0, 0, 0), exact=True)
      • Definition of done: single assertion helper, all existing test scenarios pass

            Assignee:
            Etienne Petrel
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: