-
Notifications
You must be signed in to change notification settings - Fork 25
Adding process_simple_rep_failure and process_complex_rep_failure integration tests #238
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
Open
LorantLipcsei-ETAS
wants to merge
18
commits into
eclipse-score:main
Choose a base branch
from
etas-contrib:feature/AZB-97324-tests_183_184_verified
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3f00631
AZB 97324 Source files for tests 183 and 184
LorantLipcsei-ETAS 50715a3
Fix build
TimoSteuerwaldETAS 921c20a
Remove not needed cmp & its impl
TimoSteuerwaldETAS c85b07e
Rename: Part one, folder only
TimoSteuerwaldETAS 12278a0
Rename: Part two, files and content
TimoSteuerwaldETAS a01c1a5
Update test description
TimoSteuerwaldETAS d9f446f
Drop verbose mode as it is nearly not used
TimoSteuerwaldETAS d3a0573
Code review rework: Fix Williams comments
TimoSteuerwaldETAS f9e8b78
Move test process cpp to test_helper folder
TimoSteuerwaldETAS d104503
Update list of requirements
TimoSteuerwaldETAS 64dd8dc
Verify fallback run target has been activated
TimoSteuerwaldETAS a46dae6
Tiny documentation changes
TimoSteuerwaldETAS 12b60ea
AZB 97324 Addressing PR comments
LorantLipcsei-ETAS c31d5b9
AZB 97324 Removing unnecessary code from complex_reporting_process.cpp
LorantLipcsei-ETAS 7440100
AZB 97324 Removing feat_req__lifecycle__process_failure_react from th…
LorantLipcsei-ETAS ea1e2a6
AZB 97324 Fixing launch manager references in the BUILD files
LorantLipcsei-ETAS baa9bad
AZB 97324 Fixing source and BUILD files to reflect the used folder st…
LorantLipcsei-ETAS b962fc8
AZB 97324 Fixing Test Helper BUILD file to reflect the used folder st…
LorantLipcsei-ETAS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||
| # ******************************************************************************* | ||||||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||||||
| # | ||||||
| # See the NOTICE file(s) distributed with this work for additional | ||||||
| # information regarding copyright ownership. | ||||||
| # | ||||||
| # This program and the accompanying materials are made available under the | ||||||
| # terms of the Apache License Version 2.0 which is available at | ||||||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||||||
| # | ||||||
| # SPDX-License-Identifier: Apache-2.0 | ||||||
| # ******************************************************************************* | ||||||
| load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files") | ||||||
| load("@rules_pkg//pkg:tar.bzl", "pkg_tar") | ||||||
| load("//:defs.bzl", "launch_manager_config") | ||||||
| load("//tests/utils/bazel:integration.bzl", "integration_test") | ||||||
|
|
||||||
| launch_manager_config( | ||||||
| name = "lm_process_complex_rep_failure_config", | ||||||
| config = "//tests/integration/process_complex_rep_failure:process_complex_rep_failure.json", | ||||||
| flatbuffer_out_dir = "etc", | ||||||
| ) | ||||||
|
|
||||||
| cc_binary( | ||||||
| name = "control_client_mock", | ||||||
| srcs = ["control_client_mock.cpp"], | ||||||
| deps = [ | ||||||
| "//src/control_client_lib", | ||||||
| "//src/launch_manager_daemon/lifecycle_client_lib:lifecycle_client", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| "//tests/utils/test_helper", | ||||||
| "@googletest//:gtest_main", | ||||||
| ], | ||||||
| ) | ||||||
|
|
||||||
| cc_binary( | ||||||
| name = "complex_reporting_process", | ||||||
| srcs = ["//tests/utils/test_helper:complex_reporting_process.cpp"], | ||||||
| visibility = ["//tests:__subpackages__"], | ||||||
| deps = [ | ||||||
| "//src/launch_manager_daemon/lifecycle_client_lib:lifecycle_client", | ||||||
| "//src/lifecycle_client_lib", | ||||||
| "//tests/utils/test_helper", | ||||||
| "@googletest//:gtest_main", | ||||||
| ], | ||||||
| ) | ||||||
|
|
||||||
| pkg_files( | ||||||
| name = "process_complex_rep_failure_main_files", | ||||||
| srcs = [ | ||||||
| ":complex_reporting_process", | ||||||
| ":control_client_mock", | ||||||
| "//src/launch_manager_daemon:launch_manager", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| "//tests/utils/test_helper:verification_process", | ||||||
| ], | ||||||
| attributes = pkg_attributes(mode = "0755"), | ||||||
| prefix = "tests/process_complex_rep_failure", | ||||||
| ) | ||||||
|
|
||||||
| pkg_files( | ||||||
| name = "process_complex_rep_failure_etc_files", | ||||||
| srcs = [":lm_process_complex_rep_failure_config"], | ||||||
| prefix = "tests/process_complex_rep_failure", | ||||||
| ) | ||||||
|
|
||||||
| pkg_tar( | ||||||
| name = "process_complex_rep_failure_binaries", | ||||||
| srcs = [ | ||||||
| ":process_complex_rep_failure_etc_files", | ||||||
| ":process_complex_rep_failure_main_files", | ||||||
| ], | ||||||
| ) | ||||||
|
|
||||||
| integration_test( | ||||||
| name = "process_complex_rep_failure", | ||||||
| srcs = ["process_complex_rep_failure.py"], | ||||||
| tags = ["integration"], | ||||||
| test_binaries = ":process_complex_rep_failure_binaries", | ||||||
| deps = ["//tests/utils/testing_utils"], | ||||||
| ) | ||||||
86 changes: 86 additions & 0 deletions
86
tests/integration/process_complex_rep_failure/control_client_mock.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information regarding copyright ownership. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Apache License Version 2.0 which is available at | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| ********************************************************************************/ | ||
| #include <gtest/gtest.h> | ||
|
|
||
| #include "tests/utils/test_helper/test_helper.hpp" | ||
| #include <score/lcm/control_client.h> | ||
| #include <score/lcm/lifecycle_client.h> | ||
|
|
||
| // Given a correct configuration with: | ||
| // - An initial Run Target named "Startup" containing component named | ||
| // "control_client_mock" | ||
| // - A Run Target named "run_target_app_does_report_krunning_in_time" | ||
| // containing "control_client_mock" and | ||
| // "component_does_report_krunning_in_time" | ||
| // - A Run Target named "run_target_app_does_not_report_krunning_in_time" | ||
| // containing "control_client_mock" and | ||
| // "component_does_not_report_krunning_in_time" | ||
|
|
||
| TEST(RecoveryActionComplexRepFailure, ControlClientMock) { | ||
| score::lcm::ControlClient client; | ||
|
|
||
| ASSERT_TRUE(check_clean({test_end_location, fallback_file})); | ||
|
|
||
| // Establish communication with launch manager | ||
| TEST_STEP("Report kRunning from ControlClientMock") { | ||
| auto result = score::lcm::LifecycleClient{}.ReportExecutionState( | ||
| score::lcm::ExecutionState::kRunning); | ||
| ASSERT_TRUE(result.has_value()) | ||
| << "ReportExecutionState() failed: " << result.error().Message(); | ||
| } | ||
| // Start the run target run_target_app_does_report_krunning_in_time | ||
| TEST_STEP("Activate RunTarget run_target_app_does_report_krunning_in_time") { | ||
| score::cpp::stop_token stop_token; | ||
| auto result = | ||
| client.ActivateRunTarget("run_target_app_does_report_krunning_in_time") | ||
| .Get(stop_token); | ||
| EXPECT_TRUE(result.has_value()) | ||
| << "Activating target run_target_app_does_report_krunning_in_time " | ||
| "failed: " | ||
| << result.error().Message(); | ||
| } | ||
| // Limitation: we cannot wait for the transition to fallback to complete | ||
| sleep(1); | ||
| // Then, the LM should continue without triggering the fallback | ||
| TEST_STEP("Verify fallback run target has not been activated") { | ||
| EXPECT_FALSE(std::filesystem::exists(fallback_file)) | ||
| << "Fallback run target should have not been activated"; | ||
| } | ||
| // Start the run target run_target_app_does_not_report_krunning_in_time | ||
| TEST_STEP( | ||
| "Activate RunTarget run_target_app_does_not_report_krunning_in_time") { | ||
| score::cpp::stop_token stop_token; | ||
| auto result = client | ||
| .ActivateRunTarget( | ||
| "run_target_app_does_not_report_krunning_in_time") | ||
| .Get(stop_token); | ||
| EXPECT_FALSE(result.has_value()) | ||
| << "Activating target run_target_app_does_not_report_krunning_in_time " | ||
| "did not fail as expected."; | ||
| } | ||
| // Limitation: we cannot wait for the transition to fallback to complete | ||
| sleep(1); | ||
| // Then, the LM should exhaust retries and trigger the fallback | ||
| TEST_STEP("Verify fallback run target was activated") { | ||
| EXPECT_TRUE(std::filesystem::exists(fallback_file)) | ||
| << "Fallback run target should have been activated"; | ||
| } | ||
|
|
||
| TEST_STEP("Activate RunTarget Off") { client.ActivateRunTarget("Off"); } | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| return TestRunner(__FILE__, TerminationBehavior::kContinue, | ||
| TerminationNotification::kTestEnd) | ||
| .RunTests(); | ||
| } |
153 changes: 153 additions & 0 deletions
153
tests/integration/process_complex_rep_failure/process_complex_rep_failure.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| { | ||
| "schema_version": 1, | ||
| "defaults": { | ||
| "deployment_config": { | ||
| "bin_dir": "/tmp/tests/process_complex_rep_failure", | ||
| "ready_timeout": 1.0, | ||
| "shutdown_timeout": 1.0, | ||
| "ready_recovery_action": { | ||
| "restart": { | ||
| "number_of_attempts": 0 | ||
| } | ||
| }, | ||
| "recovery_action": { | ||
| "switch_run_target": { | ||
| "run_target": "fallback_run_target" | ||
| } | ||
| }, | ||
| "environmental_variables": { | ||
| "LD_LIBRARY_PATH": "/opt/lib" | ||
| }, | ||
| "sandbox": { | ||
| "uid": 0, | ||
| "gid": 0, | ||
| "scheduling_policy": "SCHED_OTHER", | ||
| "scheduling_priority": 0 | ||
| } | ||
| }, | ||
| "component_properties": { | ||
| "application_profile": { | ||
| "application_type": "Reporting", | ||
| "is_self_terminating": true, | ||
| "alive_supervision": { | ||
| "reporting_cycle": 0.1, | ||
| "min_indications": 1, | ||
| "max_indications": 3, | ||
| "failed_cycles_tolerance": 1 | ||
| } | ||
| }, | ||
| "ready_condition": { | ||
| "process_state": "Running" | ||
| } | ||
| } | ||
| }, | ||
| "components": { | ||
| "control_client_mock": { | ||
| "component_properties": { | ||
| "binary_name": "control_client_mock", | ||
| "application_profile": { | ||
| "application_type": "State_Manager", | ||
| "alive_supervision": { | ||
| "min_indications": 0 | ||
| } | ||
| } | ||
| }, | ||
| "deployment_config": { | ||
| "ready_timeout": 1.0, | ||
| "shutdown_timeout": 1.0, | ||
| "environmental_variables": { | ||
| "PROCESSIDENTIFIER": "control_client_mock" | ||
| } | ||
| } | ||
| }, | ||
| "component_does_report_krunning_in_time": { | ||
| "component_properties": { | ||
| "binary_name": "complex_reporting_process", | ||
| "process_arguments": [ | ||
| "500.0" | ||
| ] | ||
| }, | ||
| "deployment_config": { | ||
| "ready_timeout": 1.0, | ||
| "shutdown_timeout": 1.0, | ||
| "environmental_variables": { | ||
| "PROCESSIDENTIFIER": "component_does_report_krunning_in_time" | ||
| } | ||
| } | ||
| }, | ||
| "component_does_not_report_krunning_in_time": { | ||
| "component_properties": { | ||
| "binary_name": "process_complex_reporting", | ||
| "process_arguments": [ | ||
| "1500.0" | ||
| ] | ||
| }, | ||
| "deployment_config": { | ||
| "ready_timeout": 1.0, | ||
| "shutdown_timeout": 1.0, | ||
| "environmental_variables": { | ||
| "PROCESSIDENTIFIER": "component_does_not_report_krunning_in_time" | ||
| } | ||
| } | ||
| }, | ||
| "verification_component": { | ||
| "component_properties": { | ||
| "binary_name": "verification_process", | ||
| "application_profile": { | ||
| "application_type": "Native", | ||
| "is_self_terminating": true | ||
| }, | ||
| "ready_condition": { | ||
| "process_state": "Terminated" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "run_targets": { | ||
| "Startup": { | ||
| "depends_on": [ | ||
| "control_client_mock" | ||
| ], | ||
| "recovery_action": { | ||
| "switch_run_target": { | ||
| "run_target": "fallback_run_target" | ||
| } | ||
| } | ||
| }, | ||
| "run_target_app_does_report_krunning_in_time": { | ||
| "depends_on": [ | ||
| "control_client_mock", | ||
| "component_does_report_krunning_in_time" | ||
| ], | ||
| "recovery_action": { | ||
| "switch_run_target": { | ||
| "run_target": "fallback_run_target" | ||
| } | ||
| } | ||
| }, | ||
| "run_target_app_does_not_report_krunning_in_time": { | ||
| "depends_on": [ | ||
| "control_client_mock", | ||
| "component_does_not_report_krunning_in_time" | ||
| ], | ||
| "recovery_action": { | ||
| "switch_run_target": { | ||
| "run_target": "fallback_run_target" | ||
| } | ||
| } | ||
| }, | ||
| "Off": { | ||
| "depends_on": [] | ||
| } | ||
| }, | ||
| "initial_run_target": "Startup", | ||
| "alive_supervision": { | ||
| "evaluation_cycle": 0.05 | ||
| }, | ||
| "fallback_run_target": { | ||
| "depends_on": [ | ||
| "control_client_mock", | ||
| "verification_component" | ||
| ] | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
tests/integration/process_complex_rep_failure/process_complex_rep_failure.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
| from tests.utils.testing_utils.run_until_file_deployed import run_until_file_deployed | ||
| from tests.utils.testing_utils.setup_test import setup_test | ||
| from tests.utils.testing_utils.test_results import assert_test_results | ||
| from attribute_plugin import add_test_properties | ||
|
|
||
|
|
||
| @add_test_properties( | ||
| partially_verifies=[ | ||
| "feat_req__lifecycle__recov_run_target_switch", | ||
| "feat_req__lifecycle__recovery_action_support" | ||
| ], | ||
| fully_verifies=[ | ||
| "feat_req__lifecycle__failure_detect", | ||
| ], | ||
| test_type="requirements-based", | ||
| derivation_technique="requirements-analysis", | ||
| ) | ||
| def test_recovery_action_complex_rep_failure(target, setup_test, assert_test_results, remote_test_dir): | ||
| """ | ||
| Objective: Verifies that recovery action is executed when the reporting of kRunning via mw::lifecycle library (named "complex reporting" in the following) is not happening in time and vice versa. | ||
|
|
||
| Case 1: Using complex reporting, the process does report kRunning in time (500ms below boundary) | ||
| Expected Behaviour: Reporting kRunning is successful, recovery action is not executed. | ||
|
|
||
| Case 2: Using complex reporting, the process does not report kRunning in time (500ms above boundary) | ||
| Expected Behaviour: Reporting kRunning is not successful, recovery action is executed. | ||
| The recovery action switches to the fallback run target, the activation of the fallback run target is verified in the test. | ||
| """ | ||
|
|
||
| run_until_file_deployed( | ||
| target=target, | ||
| binary_path=str(remote_test_dir / "launch_manager"), | ||
| file_path=remote_test_dir.parent / "test_end", | ||
| cwd=str(remote_test_dir), | ||
| timeout_s=10.0, | ||
| ) | ||
|
|
||
| assert_test_results({"control_client_mock.xml", "complex_reporting_process.xml"}) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Same for other occurrences. There was a folder restructure recently.