Add FIT persistency scenarios: atomic store, reset-resistant snapshots, and recovery-from-reset behavior#13
Conversation
…,recovery_from_reset
There was a problem hiding this comment.
its not fully checking atomicity. to check all or nothing you would need to e.g. change permissions of dir to read-only in the middle of scenario.
There was a problem hiding this comment.
Added AtomicStoreFlushFailure scenario (Rust + C++) for atomicity.
| /// Negative-path: un-flushed writes must NOT persist on KVS reload. | ||
| pub struct AtomicStoreNoPartialWrite; | ||
|
|
||
| impl Scenario for AtomicStoreNoPartialWrite { |
There was a problem hiding this comment.
I would say we need a scenario where flush is called but it fails
There was a problem hiding this comment.
Covered the scenario in AtomicStoreFlushFailure
There was a problem hiding this comment.
simmilar situation here, req says about being reset-resistant but no interuption is simulated. Test should check that after interuption previous snapshot can be loaded by kvs.
| "The un-flushed write (100.0) appears to have been persisted incorrectly." | ||
| ) | ||
|
|
||
| def test_instance2_recovers_to_last_flushed_value(self, results: Any, temp_dir: Path) -> None: |
There was a problem hiding this comment.
missing crucial functionality - we should make sure that kvs can load it on second try. I assume we need another binary call or at least full drop in scenario and reload
There was a problem hiding this comment.
Fixed. Scenario added in test_recovery_from_reset.py
There was a problem hiding this comment.
this is not reset API
There was a problem hiding this comment.
rust asserts get_value fails and cpp seems to not load defaults at all
There was a problem hiding this comment.
Fixed reset_key is being used now.
There was a problem hiding this comment.
it doesnt clear all previously written keys, reset clears memory state.
snapshots after rotation still have keys
There was a problem hiding this comment.
Added value assertions to both snapshot isolation test
…ry_from_reset reload phases
961950f to
aeb411c
Compare
Implements feature integration tests (FIT) verifying three core persistency requirements: KVS atomic store semantics, reset-resistant snapshot preservation, and recovery-from-reset behavior. Both Rust and C++ scenario implementations are provided with full parity across all test cases.
New Test Scenarios (Rust + C++)
Atomic Store (Atomicity of flush() Operations)
persistency.atomic_store — Verify that a single
flush()call atomically persists all pending in-memory writes. No partial-write state is observable: either all keys are present in the snapshot, or none are.persistency.atomic_store_no_partial_write — Verify the "or nothing" side of atomic store semantics by confirming that un-flushed writes never reach persistent storage when KVS is dropped without flushing.
persistency.atomic_store_multi_instance — Verify that atomic store semantics are maintained independently for each KVS instance when multiple instances operate in the same working directory.
Reset Resistant (Snapshot Preservation During Rotation)
persistency.reset_resistant — Verify that KVS preserves the previous snapshot after a flush-rotation cycle, so that a snapshot representing the last-known-good state is always available after a reset. The current snapshot (snapshot_0) holds the updated value while the previous snapshot (snapshot_1) is preserved.
persistency.reset_resistant_multi_instance — Verify that snapshot rotation for two KVS instances in the same directory is completely isolated — one instance's snapshot files never contaminate the other's rotation sequence.
Recovery From Reset (Post-Reset State Consistency)
persistency.recovery_from_reset — Verify that after a simulated reset (un-flushed in-memory write followed by process termination), the on-disk KVS snapshot still holds the last successfully flushed value. A post-reset boot therefore automatically recovers to a consistent, known-good state.
persistency.recovery_from_reset_multi_instance — Verify that two KVS instances in the same directory each independently recover to their own last-flushed state after a simulated reset, with no cross-instance snapshot contamination.
Test Scenarios Matrix
Rust & C++ (Parity Implementations)
Requirements Traceability
feat_req__persistency__multiple_kvs
feat_req__persistency__multiple_kvs
feat_req__persistency__multiple_kvs
Implementation Summary
Files Added
Python Test Cases (3 new test files):
feature_integration_tests/test_cases/tests/persistency/test_atomic_store.py— Atomic store verification testsfeature_integration_tests/test_cases/tests/persistency/test_reset_resistant.py— Reset-resistant snapshot preservation testsfeature_integration_tests/test_cases/tests/persistency/test_recovery_from_reset.py— Recovery-from-reset testsRust Scenario Implementations (3 new scenario files):
feature_integration_tests/test_scenarios/rust/src/scenarios/persistency/atomic_store.rsfeature_integration_tests/test_scenarios/rust/src/scenarios/persistency/reset_resistant.rsfeature_integration_tests/test_scenarios/rust/src/scenarios/persistency/recovery_from_reset.rsC++ Scenario Implementations (3 new scenario files):
feature_integration_tests/test_scenarios/cpp/src/scenarios/persistency/atomic_store.cppfeature_integration_tests/test_scenarios/cpp/src/scenarios/persistency/reset_resistant.cppfeature_integration_tests/test_scenarios/cpp/src/scenarios/persistency/recovery_from_reset.cppNew Base Classes:
feature_integration_tests/test_cases/persistency_scenario.py— Base class for persistency test scenarios with snapshot reading utilitiesFiles Modified
feature_integration_tests/test_cases/BUILD— Added test targets for new FIT test filesfeature_integration_tests/test_cases/fit_scenario.py— Extended base scenario infrastructurefeature_integration_tests/test_scenarios/rust/BUILD— Updated Rust build configurationfeature_integration_tests/test_scenarios/rust/src/scenarios/persistency/mod.rs— Registered new Rust scenariosfeature_integration_tests/test_scenarios/cpp/src/scenarios/mod.cpp— Registered new C++ scenariosfeature_integration_tests/test_scenarios/cpp/src/internals/persistency/kvs_instance.h— Extended KVS instance helpersfeature_integration_tests/test_scenarios/cpp/src/internals/persistency/kvs_instance.cpp— Implemented KVS instance helpersRequirements-Based Traceability
Each test is decorated with
@add_test_properties()linking to specific feature requirements from the persistency specification:feat_req__persistency__atomic_store— Atomicity of flush()feat_req__persistency__reset_resistant— Snapshot preservationfeat_req__persistency__recovery_from_reset— Recovery semanticsVerification Scope
This implementation verifies the following persistency feature requirements: