mando-cli Mock Command Implementation
New Command: mando mock up
Starts a WireMock Docker container and loads stub mappings.
mando mock up # default port 8080, auto-discover stubs
mando mock up -p 9090 # custom port
mando mock up --dir ./wiremock # explicit wiremock rootPort Flag (-p/--port)
Applies to all mock subcommands: list, add, delete, reset, log, unmatched, up. Default 8080.
Dir Flag (--dir)
Points to a WireMock root directory containing mappings/ and __files/. When provided:
mappings/*.jsonare loaded as stubs__files/is bind-mounted into the container forbodyFileNameresolution
Without --dir, stubs are auto-discovered from workspace projects.
Architecture
Port Threading
cli.rs (--port) -> MockCommand.port -> NetworkDependencyManager::with_port(port)
-> WireMockBackend::with_port(port)
-> http://localhost:{port}/__admin
Container Naming
- Default port (8080):
mando-wiremock(backward compatible withdown,status) - Non-default port:
mando-wiremock-{port}
Infra Specs
wiremock_spec()→wiremock_spec_with_port(8080)wiremock_spec_with_files(port, files_dir)adds__files/volume mount
Shared Functions
load_stubs_into() extracted to up.rs, used by both mock up and mando up. Eliminates duplication of stub-loading loop with per-file error reporting.
Stub Discovery
STUB_DIR_CANDIDATES expanded to: wiremock, wiremock/mappings, stubs, mocks, local/wiremock/mappings
This supports the standard WireMock layout used in optimization-universe-iac.
Docker Image
Changed from wiremock/wiremock:3x-alpine to wiremock/wiremock:3x for ARM64/Apple Silicon support. Healthcheck timing increased (5s startup, 30x2s retries, ~65s window) for JVM cold start.
Available Stubs
From optimization-universe-iac/local/wiremock/:
- Metis:
20-metis-timeseries.json+__files/metis/(2 timeseries response bodies) - Fingrid: not yet created
- Also: auth, MDR, position manager, OPL, ATP, EMS, algo, OTEL proxy (21 total mappings)
Pre-packaged: metis-wiremock.zip in repo root.
Files Changed
src/cli.rs— port flag, Up variant with —dirsrc/commands/mock.rs— all subcommands with port, new up() with —dir supportsrc/commands/mod.rs— port threading in dispatchsrc/commands/up.rs— shared load_stubs_into(), expanded STUB_DIR_CANDIDATESsrc/network/wiremock.rs— with_port() constructorsrc/network/manager.rs— with_port() constructorsrc/runtime/infra.rs— parameterized specs, image change, healthcheck tuning
See Also
- mando-cli-v2 — v2 architecture
- mando-cli — project overview
- mando-cli-docker-lifecycle — Docker container lifecycle
- mando-cli-mock-down-idempotent-2026-05-06 —
mando mock downimplementation + WireMock healthcheck endpoint fix (/__admin/healthinstead of/__admin) - Mando — parent project