mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-21 20:31:12 +00:00
72a9df6b57
Keep VIO package and native bridge paths backend-neutral so BASALT remains an implementation choice rather than a component boundary. Co-authored-by: Cursor <cursoragent@cursor.com>
138 lines
3.9 KiB
Python
138 lines
3.9 KiB
Python
from importlib import import_module
|
|
from pathlib import Path
|
|
|
|
COMPONENT_PACKAGES = [
|
|
"camera_ingest_calibration",
|
|
"vio_adapter",
|
|
"safety_anchor_wrapper",
|
|
"satellite_service",
|
|
"anchor_verification",
|
|
"tile_manager",
|
|
"mavlink_gcs_integration",
|
|
"fdr_observability",
|
|
]
|
|
|
|
SHARED_PACKAGES = [
|
|
"shared.contracts",
|
|
"shared.geo_geometry",
|
|
"shared.time_sync",
|
|
"shared.config",
|
|
"shared.errors",
|
|
"shared.telemetry",
|
|
]
|
|
|
|
REQUIRED_PATHS = [
|
|
"src",
|
|
"migrations/postgresql/0001_enable_postgis.sql",
|
|
"migrations/seed/README.md",
|
|
"tests/unit/test_scaffold.py",
|
|
"tests/unit/shared/.gitkeep",
|
|
"tests/unit/camera_ingest_calibration/.gitkeep",
|
|
"tests/unit/vio_adapter/.gitkeep",
|
|
"tests/unit/safety_anchor_wrapper/.gitkeep",
|
|
"tests/unit/satellite_service/.gitkeep",
|
|
"tests/unit/anchor_verification/.gitkeep",
|
|
"tests/unit/tile_manager/.gitkeep",
|
|
"tests/unit/mavlink_gcs_integration/.gitkeep",
|
|
"tests/unit/fdr_observability/.gitkeep",
|
|
"src/vio_adapter/native/README.md",
|
|
"src/satellite_service/native/README.md",
|
|
"src/anchor_verification/native/README.md",
|
|
"tests/integration/contracts/.gitkeep",
|
|
"tests/blackbox/still_image_geolocation/.gitkeep",
|
|
"tests/fixtures/project_60_images/.gitkeep",
|
|
"tests/sitl/plane_gps_input/.gitkeep",
|
|
"tests/e2e/replay/.gitkeep",
|
|
"e2e/replay/run_replay.py",
|
|
"e2e/reports/.gitkeep",
|
|
"deployment/docker/Dockerfile.runtime",
|
|
"deployment/docker/Dockerfile.replay",
|
|
"deployment/scripts/collect_evidence.sh",
|
|
"config/development/runtime.env",
|
|
"config/ci/runtime.env",
|
|
"config/jetson/runtime.env",
|
|
"config/production/runtime.env.example",
|
|
"docker-compose.yml",
|
|
"docker-compose.test.yml",
|
|
".github/workflows/ci.yml",
|
|
".env.example",
|
|
".dockerignore",
|
|
]
|
|
|
|
|
|
def test_runtime_component_public_modules_are_importable() -> None:
|
|
# Act
|
|
imported_modules = [
|
|
import_module(module_name)
|
|
for package_name in COMPONENT_PACKAGES
|
|
for module_name in (package_name, f"{package_name}.interfaces", f"{package_name}.types")
|
|
]
|
|
|
|
# Assert
|
|
assert len(imported_modules) == len(COMPONENT_PACKAGES) * 3
|
|
|
|
|
|
def test_shared_contract_locations_are_importable() -> None:
|
|
# Act
|
|
imported_modules = [import_module(package_name) for package_name in SHARED_PACKAGES]
|
|
|
|
# Assert
|
|
assert len(imported_modules) == len(SHARED_PACKAGES)
|
|
|
|
|
|
def test_generated_runtime_data_paths_are_gitkeep_only() -> None:
|
|
# Arrange
|
|
data_dirs = ["input", "expected", "cache", "fdr", "test-results"]
|
|
|
|
# Act
|
|
missing = [
|
|
directory for directory in data_dirs if not Path("data", directory, ".gitkeep").is_file()
|
|
]
|
|
|
|
# Assert
|
|
assert missing == []
|
|
|
|
|
|
def test_scaffold_paths_cover_runtime_test_and_evidence_layout() -> None:
|
|
# Act
|
|
missing = [path for path in REQUIRED_PATHS if not Path(path).exists()]
|
|
|
|
# Assert
|
|
assert missing == []
|
|
|
|
|
|
def test_native_bridge_placeholders_are_component_owned() -> None:
|
|
# Act
|
|
shared_native_path_exists = Path("src/native").exists()
|
|
|
|
# Assert
|
|
assert shared_native_path_exists is False
|
|
|
|
|
|
def test_ignore_rules_exclude_runtime_payloads_and_secrets() -> None:
|
|
# Arrange
|
|
required_patterns = [
|
|
".env",
|
|
"*.pem",
|
|
"*.key",
|
|
"data/input/*",
|
|
"data/cache/*",
|
|
"data/fdr/*",
|
|
"data/test-results/*",
|
|
"*.tlog",
|
|
"*.cbor",
|
|
"*.mp4",
|
|
]
|
|
|
|
# Act
|
|
gitignore = Path(".gitignore").read_text(encoding="utf-8")
|
|
dockerignore = Path(".dockerignore").read_text(encoding="utf-8")
|
|
missing_from_gitignore = [pattern for pattern in required_patterns if pattern not in gitignore]
|
|
missing_from_dockerignore = [
|
|
pattern for pattern in required_patterns if pattern not in dockerignore
|
|
]
|
|
|
|
# Assert
|
|
assert missing_from_gitignore == []
|
|
assert missing_from_dockerignore == []
|