-
Notifications
You must be signed in to change notification settings - Fork 20
Test Cases for default values in case of CPP added #171
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
base: main
Are you sure you want to change the base?
Test Cases for default values in case of CPP added #171
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
f484ec1 to
3e5a5c6
Compare
|
The created documentation from the pull request is available at: docu-html |
0dfea6f to
76e5d88
Compare
adding hash file generations
6e98d14 to
f011478
Compare
|
Run locally |
| 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)), | ||
| }; |
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.
Why do we need to modify rust code? Cant just C++ match outputs we already have?
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.
- 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.
97ec258 to
5548a2e
Compare
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