prometeu-runtime/discussion/workflow/plans/PLN-0108-migrate-tests-to-testplatform.md

82 lines
2.2 KiB
Markdown

---
id: PLN-0108
ticket: real-render-worker-establishment
title: Migrate Tests to TestPlatform
status: done
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [tests, platform, fixtures]
---
## Objective
Replace remaining test dependence on `Hardware::new()` and `HardwareBridge` with `TestPlatform` or narrower facade fixtures.
## Background
`DEC-0032` requires tests that need a full local platform fixture to use `TestPlatform`, not hidden `HardwareBridge` compatibility.
## Scope
### Included
- VM runtime tests.
- Firmware tests.
- Driver integration tests that still use monolithic hardware only as fixture.
- Host debugger tests where applicable.
### Excluded
- Do not remove production bridge until tests are migrated.
- Do not change behavior under test.
## Execution Steps
### Step 1 - Inventory test dependencies
**What:** Find all direct `Hardware::new()` and `HardwareBridge` test uses.
**How:** Use `rg` and classify by domain.
**File(s):** test modules across `crates/console` and `crates/host`.
### Step 2 - Migrate full-platform tests
**What:** Replace `Hardware::new()` with `TestPlatform`.
**How:** Use explicit facade accessors in assertions.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tests*.rs`, firmware tests.
### Step 3 - Migrate narrow tests
**What:** Replace full platform with narrower fixtures where only one domain is under test.
**How:** Use render/composer/audio/input/asset fixtures directly.
**File(s):** driver and runtime test modules.
## Test Requirements
### Unit Tests
- All migrated tests pass.
### Integration Tests
- `cargo test --workspace` or relevant workspace subset if full workspace is too broad.
### Manual Verification
- `rg "Hardware::new\\(|HardwareBridge" crates --glob '*test*'` shows no test dependency except tests explicitly covering legacy removal.
## Acceptance Criteria
- [ ] `TestPlatform` is the default full platform fixture.
- [ ] Tests no longer preserve `HardwareBridge` by habit.
- [ ] Narrow tests use narrower fixtures.
## Dependencies
- `PLN-0103`.
- `PLN-0107`.
## Risks
- Large mechanical changes can hide behavior regressions. Keep commits grouped by test domain.