Lab 01 — CI With Emulated Hardware + Test Pyramid

Phase: 11 — CI/CD & Testing | Difficulty: ⭐⭐⭐☆☆ | Time: 4–6 hours Language: Python 3 (stdlib) + a real GitHub Actions workflow | Hardware: none

Concept primer: ../WARMUP.md Ch. 1–4, ../HITCHHIKERS-GUIDE.md §1–§2.

Run

python3 run_tests.py     # unit (fakes) + integration (live in-process Redfish emulator)

Files

  • run_tests.py — the test pyramid runner (unit tier on fakes, integration tier on an emulator).
  • ci.yml — an example CI pipeline running a Redfish emulator as a service (no hardware).

0. The mission

Solve the role's special testing problem — no BMC in CI — with the seam + emulator + HIL answer, and see the same logic tested two ways: against a fake (unit, fast, any behavior) and against a live Redfish emulator (integration, real HTTP/JSON).

1. What to notice

  • healthy_nodes() is pure logic programmed against a PowerSource seam — so the unit tier injects a FakePowerSource (including a failing node) with zero hardware.
  • The same function runs in the integration tier against a real in-process Redfish HTTP emulator — catching the bugs fakes miss (serialization, status codes, parsing).
  • ci.yml runs the integration tier against the DMTF Redfish-Mockup-Server as a service container, plus static/sanitizer/security gates, with HIL gated to main on a self-hosted hardware pool. That's the whole pyramid in a pipeline.

2. Extensions

  1. Point the integration client at the real dmtf/redfish-mockup-server (run it locally) and at ipmi_sim/snmpsim.
  2. Add fuzzing of the Phase 08 RAS parser (atheris/property-based with hypothesis) — parsers of attacker-influenced data must be fuzzed.
  3. Add mypy/ruff/ASan gates and measure failure-path coverage (not just a line %).
  4. Build a tiny HIL harness that resets a device between tests (idempotent setup/teardown).

3. What this lab proves

You can make hardware-adjacent software thoroughly testable in CI — the seam-backed pyramid plus emulators-as-services — which is exactly the JD's "continuous improvement of build, test, and deployment pipelines." "How do you test code that needs a BMC?" becomes a demonstration, not a shrug.