Skip to content

Commit ec0b6ec

Browse files
committed
adding test_daemon in cicd
1 parent e716941 commit ec0b6ec

3 files changed

Lines changed: 42 additions & 10 deletions

File tree

feature_integration_tests/test_cases/BUILD

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ score_py_pytest(
4848
"-m rust",
4949
"--traces=all",
5050
"--rust-target-path=$(rootpath //feature_integration_tests/test_scenarios/rust:rust_test_scenarios)",
51+
"-k 'not with_daemon'",
5152
],
5253
data = [
5354
"conftest.py",
@@ -72,6 +73,7 @@ score_py_pytest(
7273
"-m cpp",
7374
"--traces=all",
7475
"--cpp-target-path=$(rootpath //feature_integration_tests/test_scenarios/cpp:cpp_test_scenarios)",
76+
"-k 'not with_daemon'",
7577
],
7678
data = [
7779
"conftest.py",
@@ -103,14 +105,21 @@ score_py_pytest(
103105
"lifecycle_scenario.py",
104106
"persistency_scenario.py",
105107
"test_properties.py",
108+
":daemon_lifecycle_configs",
106109
"//feature_integration_tests/test_scenarios/rust:rust_test_scenarios",
110+
"@score_lifecycle_health//examples/control_application:control_daemon",
111+
"@score_lifecycle_health//examples/cpp_supervised_app",
107112
"@score_lifecycle_health//examples/rust_supervised_app",
108113
"@score_lifecycle_health//src/launch_manager_daemon:launch_manager",
109114
],
110115
env = {
111116
"RUST_BACKTRACE": "1",
112117
},
113118
pytest_config = "//:pyproject.toml",
119+
tags = [
120+
"exclusive",
121+
"no-sandbox",
122+
],
114123
deps = all_requirements,
115124
)
116125

@@ -131,11 +140,18 @@ score_py_pytest(
131140
"lifecycle_scenario.py",
132141
"persistency_scenario.py",
133142
"test_properties.py",
143+
":daemon_lifecycle_configs",
134144
"//feature_integration_tests/test_scenarios/cpp:cpp_test_scenarios",
145+
"@score_lifecycle_health//examples/control_application:control_daemon",
135146
"@score_lifecycle_health//examples/cpp_supervised_app",
147+
"@score_lifecycle_health//examples/rust_supervised_app",
136148
"@score_lifecycle_health//src/launch_manager_daemon:launch_manager",
137149
],
138150
pytest_config = "//:pyproject.toml",
151+
tags = [
152+
"exclusive",
153+
"no-sandbox",
154+
],
139155
deps = all_requirements,
140156
)
141157

feature_integration_tests/test_cases/daemon_helpers.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,39 @@ def get_binary_path(target: str, version: str = "rust") -> Path:
163163
return binary_path
164164

165165

166+
def find_flatbuffer_dir_in_runfiles() -> Path | None:
167+
"""
168+
Find the generated Launch Manager flatbuffer config directory in Bazel runfiles.
169+
170+
Returns
171+
-------
172+
Path | None
173+
Path to the `flatbuffer_out` directory if found in runfiles, None otherwise.
174+
"""
175+
runfiles_dir = os.environ.get("RUNFILES_DIR") or os.environ.get("TEST_SRCDIR")
176+
if not runfiles_dir:
177+
return None
178+
179+
candidate = Path(runfiles_dir) / "_main" / "flatbuffer_out"
180+
if candidate.is_dir():
181+
return candidate
182+
183+
return None
184+
185+
166186
def copy_flatbuffer_daemon_configs(etc_dir: Path) -> None:
167187
"""
168188
Populate `etc_dir` with Launch Manager flatbuffer config binaries.
169189
170190
The current Launch Manager daemon startup path expects flatbuffer files
171191
(e.g., lm_demo.bin) in `etc/` relative to its working directory.
172192
"""
193+
flatbuffer_dir = find_flatbuffer_dir_in_runfiles()
194+
if flatbuffer_dir:
195+
for flatbuffer_file in flatbuffer_dir.glob("*.bin"):
196+
shutil.copy2(flatbuffer_file, etc_dir / flatbuffer_file.name)
197+
return
198+
173199
bazel_config = os.environ.get("FIT_BAZEL_CONFIG", "linux-x86_64")
174200
config_target = "//feature_integration_tests/test_cases:daemon_lifecycle_configs"
175201

feature_integration_tests/test_cases/tests/lifecycle/test_process_launching_with_daemon.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
These tests validate actual supervision and lifecycle management behavior
1717
by running test applications under a real Launch Manager daemon instance.
1818
19-
**Note**: These tests are designed to run with pytest directly, not through Bazel.
20-
The Launch Manager daemon requires complex configuration and workspace access
21-
that isn't compatible with Bazel's test sandbox.
22-
2319
To run these tests:
2420
2521
# Run both Rust and C++ variants
@@ -35,7 +31,6 @@
3531
"""
3632

3733
import json
38-
import os
3934
import shutil
4035
import subprocess
4136
import time
@@ -47,13 +42,8 @@
4742
from lifecycle_scenario import add_supervised_component
4843
from test_properties import add_test_properties
4944

50-
# Skip these tests when running under Bazel - they require full workspace access
51-
_running_under_bazel = os.environ.get("TEST_SRCDIR") is not None
52-
_skip_reason = "Daemon tests require pytest with workspace access (not compatible with Bazel sandbox)"
53-
5445
pytestmark = [
5546
pytest.mark.parametrize("version", ["rust", "cpp"], scope="class"),
56-
pytest.mark.skipif(_running_under_bazel, reason=_skip_reason),
5747
]
5848

5949

0 commit comments

Comments
 (0)