Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
eb2857a
AZB 97324 Source files for tests 183 and 184
LorantLipcsei-ETAS May 22, 2026
5bf0f77
Fix build
TimoSteuerwaldETAS May 27, 2026
7d6d968
Remove not needed cmp & its impl
TimoSteuerwaldETAS May 27, 2026
514c2da
Rename: Part one, folder only
TimoSteuerwaldETAS May 27, 2026
95dc805
Rename: Part two, files and content
TimoSteuerwaldETAS May 27, 2026
33c40c1
Update test description
TimoSteuerwaldETAS May 28, 2026
7526639
Drop verbose mode as it is nearly not used
TimoSteuerwaldETAS May 29, 2026
f511ac5
Code review rework: Fix Williams comments
TimoSteuerwaldETAS May 29, 2026
557cd00
Move test process cpp to test_helper folder
TimoSteuerwaldETAS May 29, 2026
b9eafaf
Update list of requirements
TimoSteuerwaldETAS May 29, 2026
2bb8d12
Verify fallback run target has been activated
TimoSteuerwaldETAS May 29, 2026
2e9fab8
Tiny documentation changes
TimoSteuerwaldETAS May 29, 2026
9e26c66
AZB 97324 Addressing PR comments
LorantLipcsei-ETAS Jun 3, 2026
397a12c
AZB 97324 Removing unnecessary code from complex_reporting_process.cpp
LorantLipcsei-ETAS Jun 4, 2026
656d861
Updating the partially verified lists (#238)
LorantLipcsei-ETAS Jun 5, 2026
9bffb0e
AZB 97324 Fixing launch manager references in the BUILD files
LorantLipcsei-ETAS Jun 9, 2026
443e232
Fixing source and BUILD files to reflect the folder structure (#238)
LorantLipcsei-ETAS Jun 11, 2026
5b7269a
Fixing Test Helper BUILD file to reflect the folder structure (#238)
LorantLipcsei-ETAS Jun 11, 2026
0246a16
AZB 97324 Fixing the config for process_complex_rep_failure
LorantLipcsei-ETAS Jun 15, 2026
7ea69fe
Fixing formatting (#238)
LorantLipcsei-ETAS Jun 16, 2026
92ecc36
Merge branch 'main' into feature/AZB-97324-tests_183_184_verified
LorantLipcsei-ETAS Jun 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/integration/crash_on_startup/crash_on_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@


@add_test_properties(
fully_verifies=["feat_req__lifecycle__failure_detect"],
fully_verifies=[
"feat_req__lifecycle__failure_detect",
"feat_req__lifecycle__recov_run_target_switch",
],
partially_verifies=["feat_req__lifecycle__recovery_action_support"],
test_type="requirements-based",
derivation_technique="requirements-analysis",
)
Expand Down
78 changes: 78 additions & 0 deletions tests/integration/process_complex_rep_failure/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# *******************************************************************************
# 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 = [
"//score/launch_manager:control_cc",
"//score/launch_manager:lifecycle_cc",
"//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 = [
"//score/launch_manager:lifecycle_cc",
"//tests/utils/test_helper",
"@googletest//:gtest_main",
],
)

pkg_files(
name = "process_complex_rep_failure_main_files",
srcs = [
":complex_reporting_process",
":control_client_mock",
"//score/launch_manager",
"//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"],
)
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/mw/lifecycle/control_client.h>
#include <score/mw/lifecycle/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::mw::lifecycle::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::mw::lifecycle::LifecycleClient{}.ReportExecutionState(
score::mw::lifecycle::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();
}
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": "complex_reporting_process",
"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"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# *******************************************************************************
# 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"})
Loading
Loading