Module test_support

Source
Expand description

Testing support.

Requires the test-support feature to be enabled.

This module contains utility functions to make it easier to both test the container-registry itself, as well as provide support when implementing tests in other crate that may need access to a container registry.

§Creating instances for testing

Start by constructing a registry with the ContainerRegistryBuilder::build_for_testing method instead of the regular ContainerRegistryBuilder::build method:

use container_registry::ContainerRegistry;
use tower::util::ServiceExt;

// Note: The registry is preconfigured differently when `build_for_testing` is used.
let ctx = ContainerRegistry::builder().build_for_testing();

// For testing of the registry itself, it can be turned into an `axum` service:/
let mut service = ctx.make_service();

// To launch the app and potentially use `app.call`:
// let app = service.ready().await.expect("could not launch service");

Structs§

RunningRegistry
A running registry.
TestingContainerRegistry
A context of a container registry instantiated for testing.