-
Notifications
You must be signed in to change notification settings - Fork 21
adding test cases for snapshot #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding test cases for snapshot #184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive C++ test coverage for KVS (Key-Value Store) snapshot functionality, enabling the existing Python test suite to run against both Rust and C++ implementations. The changes introduce new C++ test scenarios that mirror the Python snapshot tests, along with necessary helper utilities for KVS parameter parsing and instance creation.
Key Changes:
- Extended Python test parametrization to include C++ version alongside Rust
- Added C++ implementations for four snapshot test scenarios (count, max_count, restore, paths)
- Created helper utilities for KVS parameter parsing and instance management
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/python_test_cases/tests/test_cit_snapshots.py | Extended test parametrization to run snapshot tests against both "rust" and "cpp" versions; added xfail markers for known C++ bugs |
| tests/cpp_test_scenarios/src/test_objects/test_object_snapshot.hpp | Defined snapshot test scenario objects and grouped them into a scenario group |
| tests/cpp_test_scenarios/src/main.cpp | Integrated snapshot test group into the main test runner hierarchy |
| tests/cpp_test_scenarios/src/helpers/kvs_parameters.hpp | Implemented JSON parsing and validation for KVS configuration parameters |
| tests/cpp_test_scenarios/src/helpers/kvs_instance.hpp | Created utility function to instantiate KVS objects from parsed parameters |
| tests/cpp_test_scenarios/src/cit/test_snapshots.hpp | Declared four snapshot test scenario classes (SnapshotCount, SnapshotMaxCount, SnapshotRestore, SnapshotPaths) |
| tests/cpp_test_scenarios/src/cit/test_snapshots.cpp | Implemented snapshot test scenarios with detailed comments documenting known C++ implementation issues |
| tests/cpp_test_scenarios/BUILD | Updated build configuration to use glob patterns for source files and added include paths for new directory structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/cpp_test_scenarios/src/test_objects/test_object_snapshot.hpp
Outdated
Show resolved
Hide resolved
tests/cpp_test_scenarios/src/test_objects/test_object_snapshot.hpp
Outdated
Show resolved
Hide resolved
|
The created documentation from the pull request is available at: docu-html |
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @pytest.mark.xfail( | ||
| condition=lambda version: version == "cpp", | ||
| reason="Known bug in CPP code : ?", |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xfail reason is incomplete with '?'. Based on the detailed comments in test_snapshots.cpp (lines 48-58), this should reference the snapshot count issues after first flush where C++ emits snapshot_count: 0 instead of the expected min(count, snapshot_max_count).
| reason="Known bug in CPP code : ?", | |
| reason="Known bug in C++: after first flush, C++ emits snapshot_count: 0 instead of expected min(count, snapshot_max_count) (see test_snapshots.cpp lines 48-58)", |
|
|
||
| @pytest.mark.xfail( | ||
| condition=lambda version: version == "cpp", | ||
| reason="Known bug in CPP code : ?", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fill link to the BT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file shouldnt be modified. Please check your IDE settings and use 4 spaces for tab
| #include <fstream> | ||
| #include <kvs.hpp> | ||
| #include <kvsbuilder.hpp> | ||
| #include <nlohmann/json.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need it, as we have baselibs json parser?
| KvsParameters params = map_to_params(input); | ||
|
|
||
| for (uint8_t i = 0; i < count; ++i) { | ||
| auto kvs = kvs_instance(params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to define an instance in a loop? Cant we do it before loop and just flush in loop?
| { | ||
| auto kvs = kvs_instance(params); | ||
| auto restore_res = kvs.snapshot_restore(snapshot_id); | ||
| // Emit expected error messages to stderr for test compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure if we should do it like this or the impl should be changed
Test cases for cpp kvs added for snapshots.