Skip to content

Conversation

@Saumya-R
Copy link
Contributor

@Saumya-R Saumya-R commented Dec 5, 2025

Test cases for cpp kvs added for snapshots.

@Saumya-R Saumya-R requested a review from Copilot December 5, 2025 05:47
Copy link

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

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.

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

The created documentation from the pull request is available at: docu-html

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: 7aa75b5b-5e1f-4860-9796-3e84d011915f
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
DEBUG: Rule 'rust_qnx8_toolchain+' indicated that a canonical reproducible form can be obtained by modifying arguments integrity = "sha256-oEubHgeZDdT0svMmBKJx7c3/2TdSI/vfwRUyDn+TPGA="
DEBUG: Repository rust_qnx8_toolchain+ instantiated at:
  <builtin>: in <toplevel>
Repository rule http_archive defined at:
  /home/runner/.bazel/external/bazel_tools/tools/build_defs/repo/http.bzl:394:31: in <toplevel>
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'rules_rust', the root module requires module version [email protected], but got [email protected] in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_cc', the root module requires module version [email protected], but got [email protected] in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'platforms', the root module requires module version [email protected], but got [email protected] in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Loading: 
Loading: 4 packages loaded
Loading: 4 packages loaded
    currently loading: 
Analyzing: target //:license-check (5 packages loaded, 0 targets configured)
Analyzing: target //:license-check (5 packages loaded, 0 targets configured)

Analyzing: target //:license-check (84 packages loaded, 9 targets configured)

Analyzing: target //:license-check (92 packages loaded, 9 targets configured)

Analyzing: target //:license-check (155 packages loaded, 1211 targets configured)

Analyzing: target //:license-check (162 packages loaded, 6985 targets configured)

Analyzing: target //:license-check (165 packages loaded, 8995 targets configured)

INFO: Analyzed target //:license-check (165 packages loaded, 9001 targets configured).
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 65 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 24.601s, Critical Path: 0.41s
INFO: 14 processes: 5 disk cache hit, 9 internal.
INFO: Build completed successfully, 14 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@Saumya-R Saumya-R requested a review from Copilot December 5, 2025 06:05
Copy link

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

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 : ?",
Copy link

Copilot AI Dec 5, 2025

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).

Suggested change
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)",

Copilot uses AI. Check for mistakes.

@pytest.mark.xfail(
condition=lambda version: version == "cpp",
reason="Known bug in CPP code : ?",
Copy link
Contributor

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

Copy link
Contributor

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>
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link
Contributor

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

@Saumya-R Saumya-R marked this pull request as draft December 11, 2025 08:27
@Saumya-R Saumya-R removed the request for review from igorostrowskiq December 11, 2025 08:27
@Saumya-R Saumya-R closed this Dec 11, 2025
@Saumya-R Saumya-R deleted the saumya_snapshot_cpp_test_cases branch December 11, 2025 08:28
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.

2 participants