Skip to main content

Crate vidaimock

Crate vidaimock 

Source
Expand description

VidaiMock as an embeddable mock server.

Runs the same server, providers and templates as the vidaimock binary, inside your test process — so integration tests do not have to download a binary, pick a free port, spawn a process, poll for health, and tear it down again.

use vidaimock::MockServer;

let server = MockServer::builder()
    .bind("127.0.0.1:0")   // ephemeral port
    .start()
    .await?;

// Point the system under test at this URL.
let base_url = server.base_url();

server.shutdown().await?;

§Parallel tests

Instances share no global state, so any number can run concurrently. Bind to port 0 and read the real address back with MockServer::addr.

§Logging and metrics

The library deliberately does not install a tracing subscriber or a Prometheus recorder — both are process-global and would conflict with the host application’s own setup. Install your own subscriber if you want the server’s logs.

Structs§

MockServer
A running in-process VidaiMock server.
MockServerBuilder
Builds a MockServer.

Enums§

Error
Errors returned when starting or stopping an embedded server.