pub fn start_container<F: FnOnce(ContainerContext)>(&self, exposed_ports: &[u16], f: F) {
        let container_name = util::random_docker_identifier();

        self.integration_test.tokio_runtime.block_on(async {
            self.integration_test
                .docker
                .create_container(
                    Some(CreateContainerOptions {
                        name: container_name.clone(),
                    }),
                    Config {
                        image: Some(self.image_name.clone()),
                        ..container_port_mapping::port_mapped_container_config(exposed_ports)
                    },
                )
                .await
                .expect("Could not create container");

            self.integration_test
                .docker
                .start_container(&container_name, None::<StartContainerOptions<String>>)
                .await
                .expect("Could not start container");
        });

        f(ContainerContext {
            container_name,
            integration_test_context: self,
        });
    }
/// Starts a new container with the image from the integration test.
///
/// The given `exposed_ports` are mapped to random ports on the host machine. Use
/// [`ContainerContext::address_for_port`] to obtain the local port for a mapped port.
///
/// # Panics
/// - When the container could not be created
/// - When the container could not be started
Starts a new container with the image from the integration test.
The given `exposed_ports` are mapped to random ports on the host machine. Use
[`ContainerContext::address_for_port`] to obtain the local port for a mapped port.
Starts a new container with the image from the integration test . The given ` exposed_ports ` are mapped to random ports on the host machine . Use [ ` ContainerContext :: address_for_port ` ] to obtain the local port for a mapped port .
pub fn start_container<F: FnOnce(ContainerContext)>(&self, exposed_ports: &[u16], f: F) {
        let container_name = util::random_docker_identifier();
        self.integration_test.tokio_runtime.block_on(async {
            self.integration_test
                .docker
                .create_container(
                    Some(CreateContainerOptions {
                        name: container_name.clone(),
                    }),
                    Config {
                        image: Some(self.image_name.clone()),
                        ..container_port_mapping::port_mapped_container_config(exposed_ports)
                    },
                )
                .await
                .expect("Could not create container");
            self.integration_test
                .docker
                .start_container(&container_name, None::<StartContainerOptions<String>>)
                .await
                .expect("Could not start container");
        });
        f(ContainerContext {
            container_name,
            integration_test_context: self,
        });
    }
pub fn start_container < F : FnOnce ( ContainerContext ) > ( & self , exposed_ports : & [ u16 ] , f : F ) { let container_name = util :: random_docker_identifier ( ) ; self . integration_test . tokio_runtime . block_on ( async { self . integration_test . docker . create_container ( Some ( CreateContainerOptions { name : container_name . clone ( ) , } ) , Config { image : Some ( self . image_name . clone ( ) ) , .. container_port_mapping :: port_mapped_container_config ( exposed_ports ) } , ) . await . expect ( " " ) ; self . integration_test . docker . start_container ( & container_name , None :: < StartContainerOptions < String > > ) . await . expect ( " " ) ; } ) ; f ( ContainerContext { container_name , integration_test_context : self , } ) ; }
Starts a new container with the image from the integration test.
Starts a new container with the image from the integration test .
&self
exposed_ports
&[u16]
f
F
&self
exposed_ports
&[u16]
f
F
panics
When the container could not be created
When the container could not be started
When the container could not be created When the container could not be started