Skip to content

Commit 7319ae1

Browse files
committed
fixed pytest build environment issues
1 parent 5809a48 commit 7319ae1

12 files changed

Lines changed: 479 additions & 36 deletions

File tree

feature_integration_tests/LIFECYCLE_TESTS_SUMMARY.md

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Tests run with an actual Launch Manager daemon instance. This validates:
4545

4646
This test suite covers **85 of 92 lifecycle requirements** from the S-CORE Platform specification (**92% coverage**). The tests validate API integration patterns for both Rust and C++ implementations.
4747

48-
> **Note**: All tests should be run using Bazel. Direct pytest execution is a work in progress.
48+
> **Note**: Tests can be executed with both Bazel and direct pytest. Bazel is recommended for CI; pytest is supported for local development and debugging.
4949
5050
**Coverage by Category:**
5151

@@ -440,6 +440,43 @@ bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_daem
440440
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_daemon_cpp
441441
```
442442

443+
**Run lifecycle tests with pytest (local):**
444+
445+
```bash
446+
# All lifecycle tests (Rust + C++)
447+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v
448+
449+
# Rust only
450+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v -m rust
451+
452+
# C++ only
453+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v -m cpp
454+
```
455+
456+
**Build scenario executables from pytest:**
457+
458+
```bash
459+
# Build with default Bazel config (linux-x86_64)
460+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ \
461+
--build-scenarios \
462+
--build-scenarios-timeout=600 \
463+
-q -v
464+
465+
# Build with explicit Bazel config
466+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ \
467+
--build-scenarios \
468+
--bazel-config=linux-x86_64 \
469+
--build-scenarios-timeout=600 \
470+
-q -v
471+
472+
# Or via environment override
473+
FIT_BAZEL_CONFIG=linux-x86_64 \
474+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ \
475+
--build-scenarios \
476+
--build-scenarios-timeout=600 \
477+
-q -v
478+
```
479+
443480
### Quick Start
444481

445482
#### API Integration Tests (Fast, No Daemon Required)
@@ -472,6 +509,18 @@ bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_cpp
472509
--test_filter="*test_process_launching*"
473510
```
474511

512+
**Using pytest (direct local run):**
513+
514+
```bash
515+
# Full lifecycle API-mode set
516+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v
517+
518+
# Single file
519+
python3 -m pytest \
520+
feature_integration_tests/test_cases/tests/lifecycle/test_process_launching.py \
521+
-q -v
522+
```
523+
475524
#### Daemon Integration Tests (End-to-End Validation)
476525

477526
**Using Bazel:**
@@ -485,6 +534,21 @@ bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_daem
485534
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_daemon_rust --test_output=all
486535
```
487536

537+
**Using pytest (direct local run):**
538+
539+
```bash
540+
# Daemon integration file (Rust + C++)
541+
python3 -m pytest \
542+
feature_integration_tests/test_cases/tests/lifecycle/test_process_launching_with_daemon.py \
543+
-q -v
544+
```
545+
546+
Local daemon fixture notes:
547+
548+
- The fixture builds required binaries with Bazel using `--config=linux-x86_64` by default.
549+
- Override Bazel config with `FIT_BAZEL_CONFIG` when needed.
550+
- The fixture prepares required flatbuffer config binaries automatically.
551+
488552
### Understanding Build Configurations
489553

490554
**Bazel `--config` flag:**
@@ -600,6 +664,7 @@ When running daemon integration tests, the Launch Manager requires a configurati
600664
},
601665
"initial_run_target": "startup"
602666
}
667+
```
603668

604669
## Dependencies
605670

@@ -625,12 +690,12 @@ When running daemon integration tests, the Launch Manager requires a configurati
625690
Potential areas for expansion:
626691

627692
1. **Enhanced Daemon Integration**:
628-
- Basic daemon fixture and test infrastructure
629-
- Supervised application launching tests
630-
- Dynamic configuration updates via control interface
631-
- Comprehensive health monitoring validation
632-
- Multi-daemon distributed scenarios
633-
- Performance metrics collection (timing, resource usage)
693+
- Basic daemon fixture and test infrastructure
694+
- Supervised application launching tests
695+
- Dynamic configuration updates via control interface
696+
- Comprehensive health monitoring validation
697+
- Multi-daemon distributed scenarios
698+
- Performance metrics collection (timing, resource usage)
634699

635700
2. **Additional Test Scenarios**:
636701
- Process termination and cleanup validation
@@ -667,4 +732,4 @@ Potential areas for expansion:
667732

668733
---
669734

670-
**Summary**: This test suite covers 85 of 92 lifecycle requirements (92% coverage) and validates API integration patterns for both Rust and C++ implementations. Tests run with Bazel for both API integration mode (fast CI feedback) and daemon integration mode (comprehensive end-to-end validation). The dual-language implementation ensures both ecosystems have equal support and validates that lifecycle APIs work correctly across languages.
735+
**Summary**: This test suite covers 85 of 92 lifecycle requirements (92% coverage) and validates API integration patterns for both Rust and C++ implementations. Tests can run with Bazel (recommended for CI) and with direct pytest (recommended for local debugging) for both API integration and daemon integration modes. The dual-language implementation ensures both ecosystems have equal support and validates that lifecycle APIs work correctly across languages.

feature_integration_tests/README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ This directory contains Feature Integration Tests for the S-CORE project. It inc
1919
- `test_ssh.py` — SSH connectivity tests
2020
- `configs/` — Configuration files for ITF execution (DLT, QEMU bridge, etc.)
2121

22+
## Lifecycle FIT Summary
23+
24+
Lifecycle Feature Integration Tests validate end-to-end integration patterns for the S-CORE lifecycle stack across Rust and C++ scenarios.
25+
26+
- Coverage: 85/92 lifecycle requirements (92%)
27+
- Modes:
28+
- API integration mode (no running daemon required)
29+
- Daemon integration mode (real Launch Manager behavior)
30+
- Main validated areas:
31+
- Process launching and dependency ordering (sequential/parallel)
32+
- Conditional launching and run targets
33+
- Process security/resources/termination
34+
- Monitoring, recovery, control interface, logging, and configuration handling
35+
36+
For full lifecycle requirement mapping and detailed rationale, see `feature_integration_tests/LIFECYCLE_TESTS_SUMMARY.md`.
37+
2238
## Running Tests
2339

2440
### Python Test Cases (scenario-based FIT)
@@ -36,6 +52,57 @@ bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_rust
3652
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_cpp
3753
```
3854

55+
To run daemon integration test suites:
56+
57+
```sh
58+
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_daemon_rust
59+
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_daemon_cpp
60+
```
61+
62+
To run lifecycle-focused tests only:
63+
64+
```sh
65+
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_rust --test_filter="*lifecycle*"
66+
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_cpp --test_filter="*lifecycle*"
67+
```
68+
69+
Pytest direct local runs are also supported:
70+
71+
```sh
72+
# All lifecycle tests (rust + cpp)
73+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v
74+
75+
# Rust only
76+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v -m rust
77+
78+
# C++ only
79+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ -q -v -m cpp
80+
```
81+
82+
To build scenario executables from pytest before running tests:
83+
84+
```sh
85+
# Default Bazel config: linux-x86_64
86+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ \
87+
--build-scenarios \
88+
--build-scenarios-timeout=600 \
89+
-q -v
90+
91+
# Explicit Bazel config
92+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ \
93+
--build-scenarios \
94+
--bazel-config=linux-x86_64 \
95+
--build-scenarios-timeout=600 \
96+
-q -v
97+
98+
# Or via environment override
99+
FIT_BAZEL_CONFIG=linux-x86_64 \
100+
python3 -m pytest feature_integration_tests/test_cases/tests/lifecycle/ \
101+
--build-scenarios \
102+
--build-scenarios-timeout=600 \
103+
-q -v
104+
```
105+
39106
### ITF Tests (QEMU-based)
40107

41108
ITF tests run on a QEMU target and require the `itf-qnx-x86_64` config:

feature_integration_tests/test_cases/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# *******************************************************************************
1313
load("@pip_score_venv_test//:requirements.bzl", "all_requirements")
1414
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
15+
load("@score_lifecycle_health//:defs.bzl", "launch_manager_config")
1516
load("@score_tooling//python_basics:defs.bzl", "score_py_pytest")
1617

1718
# In order to update the requirements, change the `requirements.txt` file and run:
@@ -34,6 +35,11 @@ compile_pip_requirements(
3435
],
3536
)
3637

38+
launch_manager_config(
39+
name = "daemon_lifecycle_configs",
40+
config = "//feature_integration_tests/test_cases/configs:daemon_launch_manager_config.json",
41+
)
42+
3743
# Tests targets
3844
score_py_pytest(
3945
name = "fit_rust",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# *******************************************************************************
2+
3+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
4+
5+
#
6+
7+
# See the NOTICE file(s) distributed with this work for additional
8+
9+
# information regarding copyright ownership
10+
11+
#
12+
13+
# This program and the accompanying materials are made available under the
14+
15+
# terms of the Apache License Version 2.0 which is available at
16+
17+
# <https://www.apache.org/licenses/LICENSE-2.0>
18+
19+
#
20+
21+
# SPDX-License-Identifier: Apache-2.0
22+
23+
# *******************************************************************************
24+
25+
exports_files([
26+
"daemon_launch_manager_config.json",
27+
])
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"schema_version": 1,
3+
"defaults": {
4+
"deployment_config": {
5+
"bin_dir": "bin/",
6+
"ready_recovery_action": {
7+
"restart": {
8+
"number_of_attempts": 1,
9+
"delay_before_restart": 0.5
10+
}
11+
}
12+
},
13+
"component_properties": {
14+
"application_profile": {
15+
"application_type": "Reporting",
16+
"is_self_terminating": false,
17+
"alive_supervision": {
18+
"reporting_cycle": 0.1,
19+
"min_indications": 1,
20+
"max_indications": 3,
21+
"failed_cycles_tolerance": 1
22+
}
23+
},
24+
"depends_on": [],
25+
"process_arguments": [],
26+
"ready_condition": {
27+
"process_state": "Running"
28+
}
29+
},
30+
"run_target": {
31+
"transition_timeout": 5,
32+
"recovery_action": {
33+
"switch_run_target": {
34+
"run_target": "fallback_run_target"
35+
}
36+
}
37+
},
38+
"alive_supervision": {
39+
"evaluation_cycle": 0.5
40+
}
41+
},
42+
"components": {
43+
"state_manager": {
44+
"description": "State Manager application",
45+
"component_properties": {
46+
"binary_name": "control_daemon",
47+
"application_profile": {
48+
"application_type": "State_Manager",
49+
"alive_supervision": {
50+
"min_indications": 0
51+
}
52+
},
53+
"depends_on": []
54+
}
55+
},
56+
"cpp_supervised_app": {
57+
"component_properties": {
58+
"binary_name": "cpp_supervised_app",
59+
"application_profile": {
60+
"application_type": "Reporting_And_Supervised"
61+
},
62+
"process_arguments": [
63+
"-d50"
64+
]
65+
},
66+
"deployment_config": {
67+
"environmental_variables": {
68+
"PROCESSIDENTIFIER": "cpp_supervised_app",
69+
"CONFIG_PATH": "etc/hmproc_cpp_supervised_app.bin",
70+
"IDENTIFIER": "cpp_supervised_app"
71+
}
72+
}
73+
},
74+
"rust_supervised_app": {
75+
"component_properties": {
76+
"binary_name": "rust_supervised_app",
77+
"application_profile": {
78+
"application_type": "Reporting_And_Supervised"
79+
},
80+
"process_arguments": [
81+
"-d50"
82+
]
83+
},
84+
"deployment_config": {
85+
"environmental_variables": {
86+
"PROCESSIDENTIFIER": "rust_supervised_app",
87+
"CONFIG_PATH": "etc/hmproc_rust_supervised_app.bin",
88+
"IDENTIFIER": "rust_supervised_app"
89+
}
90+
}
91+
}
92+
},
93+
"run_targets": {
94+
"Startup": {
95+
"description": "Minimal functionality of the system",
96+
"depends_on": [
97+
"cpp_supervised_app",
98+
"rust_supervised_app",
99+
"state_manager"
100+
],
101+
"recovery_action": {
102+
"switch_run_target": {
103+
"run_target": "fallback_run_target"
104+
}
105+
}
106+
}
107+
},
108+
"initial_run_target": "Startup",
109+
"fallback_run_target": {
110+
"description": "Switching off everything",
111+
"depends_on": [
112+
"state_manager"
113+
],
114+
"transition_timeout": 1.5
115+
},
116+
"alive_supervision": {
117+
"evaluation_cycle": 0.5
118+
}
119+
}

0 commit comments

Comments
 (0)