pub struct TestInstance {
pub configs: TypeMap,
pub op: DockerOperations,
}
Expand description
Fields§
§configs: TypeMap
§op: DockerOperations
Implementations§
Source§impl TestInstance
impl TestInstance
Sourcepub fn new(configs: TypeMap, op: DockerOperations) -> Self
pub fn new(configs: TypeMap, op: DockerOperations) -> Self
Returns a new TestInstance.
Sourcepub fn server<S: Server>(&self) -> S
pub fn server<S: Server>(&self) -> S
Returns an instance of the requested type that implements Server.
Internally a TestInstance has a TypeMap which contains all of the Configs that were registered with a given Test. Since each Config has a one-to-one relationship with a Server, an instance of a Server can be created by simply having a copy of it’s associated Config. This method performs that mapping for you, looking for a Config of the type specified by Server::Config in the type map and then generating and returning a new instance of the Server using the Config and runtime data generated when the underlying container was brought up.
Note that it then follows this method will fail if the passed Server type did not have it’s associated Config registered when the Test was created.