Skip to content

Conversation

@Saumya-R
Copy link
Contributor

This PR adds C++ test cases for default values scenarios to achieve parity with existing Rust tests. The implementation includes a temporary workaround to create hash files for C++ KVS, which requires them for validation (unlike Rust). The changes enable parameterized testing across both Rust and C++ versions.

Key changes:

Added C++ test scenarios for default values testing (default_values, remove_key, reset operations, checksum)
Implemented temporary hash file generation in Python test fixtures to support C++ requirements
Modified Rust test scenarios to use string-based result logging for cross-language compatibility

The CPP KVS needs a hash file which is not needed by RUST , leading to failure of test cases.
Created the issue at : #170

@Saumya-R Saumya-R changed the title Saumya cpp default values test Test Cases for default values in case of CPP added Nov 19, 2025
@github-actions
Copy link

github-actions bot commented Nov 19, 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: c453fa65-5868-45b4-94b7-11a17c9b4baf
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 (156 packages loaded, 2772 targets configured)

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

INFO: Analyzed target //:license-check (165 packages loaded, 9001 targets configured).
[9 / 14] [Prepa] Executing genrule //:filtered_cargo_lock ... (2 actions, 0 running)
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: 21.779s, Critical Path: 0.34s
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 force-pushed the saumya_cpp_default_values_test branch 2 times, most recently from f484ec1 to 3e5a5c6 Compare November 19, 2025 09:43
@Saumya-R Saumya-R marked this pull request as draft November 19, 2025 09:48
@github-actions
Copy link

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

@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch 5 times, most recently from 0dfea6f to 76e5d88 Compare November 19, 2025 12:29
@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch from 6e98d14 to f011478 Compare November 19, 2025 12:49
@Saumya-R Saumya-R marked this pull request as ready for review November 19, 2025 12:57
@Saumya-R Saumya-R requested a review from PiotrKorkus November 19, 2025 12:57
@igorostrowskiq
Copy link
Contributor

Run locally bazel run //:format.fix to fix format issues

Comment on lines +132 to +139
let value_is_default = match kvs.is_value_default(key) {
Ok(v) => format!("Ok({})", v),
Err(e) => to_str(&Err::<bool, rust_kvs::error_code::ErrorCode>(e)),
};
let current_value = match kvs.get_value_as::<f64>(key) {
Ok(v) => format!("Ok(F64({:.1}))", v),
Err(e) => to_str(&Err::<f64, rust_kvs::error_code::ErrorCode>(e)),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to modify rust code? Cant just C++ match outputs we already have?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Justification for changes to Rust code:
    • The issue is that the Rust tracer outputs native types (e.g., numbers, booleans) in JSON, while the C++ TRACE macro currently stringifies all data, making everything a string in the output.
    • For pytest fixtures to interpret both Rust and C++ outputs identically, we have two options:
      1. Change the C++ TRACE macro (or logging method) to output native types.
      2. Change the Rust test code to stringify its data.

Refactor C++ main exception handling to use unique exit codes for errors.
Extract hash file creation into a separate function for clarity.
Remove redundant temp_dir logic from Python fixtures and rely on pytest setup.
Remove leftover get_binary usage in pytest configuration.
Suppress unnecessary defaults file warnings in conftest.py.
Replace explicit srcs list with glob in Bazel BUILD for maintainability.

Ensure output parity between Rust and C++ scenario runners. The Rust tracer
outputs native types in JSON, while the C++ TRACE macro stringifies all data.
To enable pytest fixtures to interpret both outputs identically, updated
the Rust test code.
@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch from 97ec258 to 5548a2e Compare November 20, 2025 12:20
@Saumya-R Saumya-R requested a review from PiotrKorkus November 20, 2025 12: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.

3 participants