Skip to content

Make snapshot generation explicit in test setup - #8329

Open
cjen1-msft wants to merge 11 commits into
microsoft:mainfrom
cjen1-msft:snapshot-infra-02-generation
Open

Make snapshot generation explicit in test setup#8329
cjen1-msft wants to merge 11 commits into
microsoft:mainfrom
cjen1-msft:snapshot-infra-02-generation

Conversation

@cjen1-msft

@cjen1-msft cjen1-msft commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Replace implicit snapshot generation and copying in test setup with explicit triggers and passive waits.

Builds on the disk-backed helpers from #8317, now merged.

Migrate generation and inspection scenarios in e2e_operations.py and recovery_snapshot_endorsements.py. Manual snapshot tests retain their explicit triggers and assert the returned snapshot's contents. Fetch scenarios replace interval-sized transaction batches with a committed application transaction, trigger_snapshot(), and wait_for_snapshot(). The target is the application transaction, not the trigger request's TxID, which may be newer than the snapshot boundary.

Large-snapshot, snapshot access, and representation-digest checks read node-owned files directly. Snapshot selection waits for distinct committed generations instead of sleeping, while retaining its intentional copies to backups. The fetch-size-limit case writes a 2 KB payload and asserts that the generated snapshot exceeds the 1 KB limit before checking rejection.

Generated files are read directly rather than copied through common_dir. No new infrastructure helper is needed. Recovery fixture copying, other join paths, corruption, and LTS callers remain for later slices.

scripts/ci-checks.sh passes. The affected schema_test scenarios and recovery_snapshot_endorsements_test could not start locally because the logging application executable is missing. End-to-end execution remains outstanding.

Chris Jensen (Cjen1) and others added 11 commits September 8, 2026 15:32
Add node-local committed snapshot listing and passive target-seqno waiting. Migrate timing, election, and persistence callers without changing generation or recovery-copy behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the helper-only snapshot file tests and their CMake registration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the existing snapshot trigger's target when reading governance history. Compare recovery snapshot files in place, including read-only inputs, without copying into common_dir.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace eight combined snapshot-helper calls with explicit triggers and passive waits. Use committed application transactions as snapshot targets and read generated files directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use explicit snapshot triggers and passive waits for large snapshots, access and digest checks, selection, and fetch-size limits. Preserve intentional backup copies and assert the oversized snapshot precondition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cjen1-msft
cjen1-msft marked this pull request as ready for review September 10, 2026 17:12
@cjen1-msft
cjen1-msft requested a review from a team as a code owner September 10, 2026 17:12
Copilot AI lite review requested due to automatic review settings September 10, 2026 17:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Snapshot selection currently drops the view component when sorting snapshots, which can mis-order candidates and select the wrong “best” snapshot when multiple views share a seqno.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates CCF’s Python end-to-end tests to make snapshot creation/selection explicit during test setup, replacing implicit snapshot generation/copying with explicit trigger_snapshot() calls and passive wait_for_snapshot() waits, and reading node-owned snapshot files directly where needed.

Changes:

  • Replace uses of network.get_committed_snapshots(...) (and ad-hoc directory scans) with primary.trigger_snapshot() + primary.wait_for_snapshot(...) in snapshot-driven scenarios.
  • Update snapshot inspection tests to open the returned snapshot file directly (rather than scanning/copying from a committed snapshots directory).
  • Refactor snapshot-selection setup logic to build candidate lists from primary.get_snapshots().

Custom instructions used:

  • None (no additional repository instruction files or Skills were loaded for this review).
File summaries
File Description
tests/recovery_snapshot_endorsements.py Switch one setup path to explicit snapshot trigger + wait before continuing the recovery endorsement flow.
tests/e2e_operations.py Migrate multiple snapshot-related scenarios to trigger_snapshot()/wait_for_snapshot() and node-owned snapshot file reads, removing implicit snapshot directory polling/copying.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/e2e_operations.py
Comment on lines +684 to +685
seqno, _ = ccf.ledger.snapshot_index_from_filename(snapshot_path)
src_snapshots.append((seqno, os.path.basename(snapshot_path), snapshot_path))
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.

4 participants