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: 73449470-71f9-4e37-88a6-2ff6c0909260
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: 
Computing main repo mapping: 
WARNING: For repository 'rules_rust', the root module requires module version rules_rust@0.56.0, but got rules_rust@0.61.0 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 rules_cc@0.1.1, but got rules_cc@0.1.2 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 platforms@0.0.11, but got platforms@1.0.0 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 (154 packages loaded, 2630 targets configured)

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

INFO: Analyzed target //:license-check (165 packages loaded, 9001 targets configured).
[12 / 14] checking cached actions
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: 25.879s, Critical Path: 0.33s
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 6 times, most recently 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

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

Please restore and use 4 space indentation for cpp files

@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch 2 times, most recently from ec4cde8 to 1b1d2b6 Compare December 3, 2025 07:25
Copy link
Member

@pahmann pahmann left a comment

Choose a reason for hiding this comment

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

I am missing any information for the test properties on which requirements they apply to and which test method was used. They are supposed to be Component Integration Tests, so we should be able to find a description as mentioned here: https://github.com/eclipse-score/process_description/blob/main/process/process_areas/verification/guidance/verification_templates.rst#c-properties-template

reset_single_key_scenario, checksum_scenario},
{}}};

ScenarioGroup::Ptr cit_group{
Copy link
Contributor

Choose a reason for hiding this comment

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

Only Component Integratio Tests are expected here AFAIK, so we can remove this additional group.

std::cerr << ex.what() << std::endl;
return 1;
run_cli_app(raw_arguments, test_context);
} catch (const ScenarioError &ex) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if we want try catch around run_cli_app at all.
Right now there is just a description string that you still need to find manually or add some debug steps.
Without try catch there will be termination like:

terminate called after throwing an instance of 'std::runtime_error'
  what():  TestError

and you just need to rerun it with gdb with bt at the end to find where it happened.

To be discussed.

@igorostrowskiq
Copy link
Contributor

Partial review done, have not touched test implementation yet.

@PiotrKorkus
Copy link
Contributor

I am missing any information for the test properties on which requirements they apply to and which test method was used. They are supposed to be Component Integration Tests, so we should be able to find a description as mentioned here: https://github.com/eclipse-score/process_description/blob/main/process/process_areas/verification/guidance/verification_templates.rst#c-properties-template

Hi @pahmann, the properties are added in python file:
https://github.com/eclipse-score/persistency/pull/171/files#diff-a584b9bf616ce290a7c22550473b7fd287de6869aa29a48c2bfbaa91cfafae4eR92-R107

* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifndef TEST_DEFAULT_VALUES_HPP
#define TEST_DEFAULT_VALUES_HPP
Copy link
Contributor

Choose a reason for hiding this comment

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

Header guard or #pragma once, choose one. I would go for the pragma version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When choosing one, Does the header guard does not give more portability?
In my knowledge the pragma is not supported by a few compilers.

*
* @param key The key being queried or modified in the KVS.
* @param value_is_default String encoding whether the current value matches the
* default ("Ok(true)", "Ok(false)", or error string).
Copy link
Contributor

Choose a reason for hiding this comment

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

I can see now that we actually have python part with Ok(), Err() and lots of stringification... It should be refactored to have there original values. But it will be done as some future task, now let's keep it as is for now.

<< std::get<double>(get_value_result.value().getValue());
current_value = "Ok(F64(" + oss.str() + "))";
}
// value_is_default
Copy link
Contributor

Choose a reason for hiding this comment

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

In rust there is a special function to determine if given value is default or set value. In a scenario where default value is set to x and then the key is overwritten with regular value x this WorkAround would still show that is default value. Rust implementation would return that is later set value.

I would contact cpp persistency devs to determine if they are going to fix the gap to understand where it is going to and maybe just use has_default_value for now with eventual xfail.

That applies to many other occurrences of this issue - we can discuss.

@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch from 5c92761 to b148d5b Compare December 9, 2025 09:02
@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch 3 times, most recently from 8530283 to d8a875c Compare December 11, 2025 07:07
antonkri and others added 9 commits December 11, 2025 12:50
* Use docs_as_code 2.0.1
* Use score_platform 0.4.1
* external needs are necessary when using persistency, they cannot be dev_dependency

Co-authored-by: Alexander Lanin <Alexander.Lanin@etas.com>
Added missing copyright check and copyright info to some files.

Signed-off-by: Nicolae Dicu <nicolae.dicu.ext@qorix.ai>
- `KvsSerialize` and `KvsDeserialize` traits.
- Basic types support.
  - Unit tests for basic types serialization/deserialization.
- Use-case examples.
Replaced `Option` with `SerializationFailed` and `DeserializationFailed`
errors, containing string with failure reason.
- Require hash file for default files.
- Make hash parameter non-optional.
- Update tests.
- moving code to namespace
- add empty lines
- remove default value vector
- move comparison to function
- added enum for FAILURE result code

adding spaces to comments
@Saumya-R Saumya-R force-pushed the saumya_cpp_default_values_test branch from d8a875c to effcf28 Compare December 11, 2025 07:24
@Saumya-R Saumya-R marked this pull request as draft December 11, 2025 07:44
@Saumya-R Saumya-R added duplicate This issue or pull request already exists invalid This doesn't seem right labels Dec 11, 2025
@Saumya-R Saumya-R self-assigned this Dec 11, 2025
@Saumya-R Saumya-R requested review from arkjedrz and removed request for PiotrKorkus and arkjedrz December 11, 2025 08:05
@Saumya-R
Copy link
Contributor Author

A new PR is created to clean and address the issues.
#189

@Saumya-R Saumya-R closed this Dec 11, 2025
@Saumya-R Saumya-R deleted the saumya_cpp_default_values_test branch December 11, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants