async fn start_stub(&self, component_url: &str) -> Result<(), fntr::Error> {
        // Stubs exist only within the hermetic-network realm. Therefore,
        // the hermetic-network realm must exist.
        let hermetic_network_connector = self
            .hermetic_network_connector
            .as_ref()
            .ok_or(fntr::Error::HermeticNetworkRealmNotRunning)?;

        if has_stub(hermetic_network_connector).await? {
            // The `Controller` only configures one test stub at a time. As a
            // result, any existing stub must be stopped before a new one is
            // started.
            self.stop_stub().await.map_err(|e| match e {
                fntr::Error::StubNotRunning => {
                    error!("attempted to stop stub that was not running");
                    fntr::Error::Internal
                }
                fntr::Error::AddressInUse
                | fntr::Error::AddressNotAvailable
                | fntr::Error::ComponentNotFound
                | fntr::Error::HermeticNetworkRealmNotRunning
                | fntr::Error::Internal
                | fntr::Error::InterfaceNotFound
                | fntr::Error::InvalidArguments
                | fntr::Error::PingFailed
                | fntr::Error::TimeoutExceeded => e,
            })?;
        }

        create_child(
            fdecl::CollectionRef { name: network_test_realm::STUB_COLLECTION_NAME.to_string() },
            create_child_decl(network_test_realm::STUB_COMPONENT_NAME, component_url),
            hermetic_network_connector,
        )
        .await
    }
/// Starts a test stub within the hermetic-network realm.
Starts a test stub within the hermetic-network realm.
Starts a test stub within the hermetic - network realm .
async fn start_stub(&self, component_url: &str) -> Result<(), fntr::Error> {
        // Stubs exist only within the hermetic-network realm. Therefore,
        // the hermetic-network realm must exist.
        let hermetic_network_connector = self
            .hermetic_network_connector
            .as_ref()
            .ok_or(fntr::Error::HermeticNetworkRealmNotRunning)?;
        if has_stub(hermetic_network_connector).await? {
            // The `Controller` only configures one test stub at a time. As a
            // result, any existing stub must be stopped before a new one is
            // started.
            self.stop_stub().await.map_err(|e| match e {
                fntr::Error::StubNotRunning => {
                    error!("attempted to stop stub that was not running");
                    fntr::Error::Internal
                }
                fntr::Error::AddressInUse
                | fntr::Error::AddressNotAvailable
                | fntr::Error::ComponentNotFound
                | fntr::Error::HermeticNetworkRealmNotRunning
                | fntr::Error::Internal
                | fntr::Error::InterfaceNotFound
                | fntr::Error::InvalidArguments
                | fntr::Error::PingFailed
                | fntr::Error::TimeoutExceeded => e,
            })?;
        }
        create_child(
            fdecl::CollectionRef { name: network_test_realm::STUB_COLLECTION_NAME.to_string() },
            create_child_decl(network_test_realm::STUB_COMPONENT_NAME, component_url),
            hermetic_network_connector,
        )
        .await
    }
async fn start_stub ( & self , component_url : & str ) -> Result < ( ) , fntr :: Error > { // Stubs exist only within the hermetic-network realm. Therefore, // the hermetic-network realm must exist. let hermetic_network_connector = self . hermetic_network_connector . as_ref ( ) . ok_or ( fntr :: Error :: HermeticNetworkRealmNotRunning ) ? ; if has_stub ( hermetic_network_connector ) . await ? { // The `Controller` only configures one test stub at a time. As a // result, any existing stub must be stopped before a new one is // started. self . stop_stub ( ) . await . map_err ( | e | match e { fntr :: Error :: StubNotRunning => { error ! ( " " ) ; fntr :: Error :: Internal } fntr :: Error :: AddressInUse | fntr :: Error :: AddressNotAvailable | fntr :: Error :: ComponentNotFound | fntr :: Error :: HermeticNetworkRealmNotRunning | fntr :: Error :: Internal | fntr :: Error :: InterfaceNotFound | fntr :: Error :: InvalidArguments | fntr :: Error :: PingFailed | fntr :: Error :: TimeoutExceeded => e , } ) ? ; } create_child ( fdecl :: CollectionRef { name : network_test_realm :: STUB_COLLECTION_NAME . to_string ( ) } , create_child_decl ( network_test_realm :: STUB_COMPONENT_NAME , component_url ) , hermetic_network_connector , ) . await }
Starts a test stub within the hermetic-network realm.
Starts a test stub within the hermetic - network realm .
&self
component_url
&str
&self
component_url
&str