pub(crate) async fn build(self) -> Result<TestSetup, Error> {
        let mut setup = TestSetup::new()?;
        if !self.endpoints.is_empty() {
            let () = setup.configure_network(self.endpoints.into_iter()).await?;
        }

        // configure all the stacks:
        for stack_cfg in self.stacks.into_iter() {
            println!("Adding stack: {:?}", stack_cfg);
            let mut stack = TestStack::new();

            for (ep_name, addr) in stack_cfg.endpoints.into_iter() {
                // get the endpoint from the sandbox config:
                let endpoint = setup.get_endpoint(&ep_name).await?;
                let cli = stack.connect_stack()?;
                let if_id = add_stack_endpoint(&cli, endpoint).await?;
                // We'll ALWAYS await for the newly created interface to come up
                // online before returning, so users of `TestSetupBuilder` can
                // be 100% sure of the state once the setup is done.
                stack.wait_for_interface_online(if_id).await;
                if let Some(addr) = addr {
                    configure_endpoint_address(&cli, if_id, addr).await?;
                }

                assert_eq!(stack.endpoint_ids.insert(ep_name, if_id), None);
            }

            setup.add_stack(stack)
        }

        Ok(setup)
    }
/// Attempts to build a [`TestSetup`] with the provided configuration.
Attempts to build a [`TestSetup`] with the provided configuration.
Attempts to build a [ ` TestSetup ` ] with the provided configuration .
pub(crate) async fn build(self) -> Result<TestSetup, Error> {
        let mut setup = TestSetup::new()?;
        if !self.endpoints.is_empty() {
            let () = setup.configure_network(self.endpoints.into_iter()).await?;
        }
        // configure all the stacks:
        for stack_cfg in self.stacks.into_iter() {
            println!("Adding stack: {:?}", stack_cfg);
            let mut stack = TestStack::new();
            for (ep_name, addr) in stack_cfg.endpoints.into_iter() {
                // get the endpoint from the sandbox config:
                let endpoint = setup.get_endpoint(&ep_name).await?;
                let cli = stack.connect_stack()?;
                let if_id = add_stack_endpoint(&cli, endpoint).await?;
                // We'll ALWAYS await for the newly created interface to come up
                // online before returning, so users of `TestSetupBuilder` can
                // be 100% sure of the state once the setup is done.
                stack.wait_for_interface_online(if_id).await;
                if let Some(addr) = addr {
                    configure_endpoint_address(&cli, if_id, addr).await?;
                }
                assert_eq!(stack.endpoint_ids.insert(ep_name, if_id), None);
            }
            setup.add_stack(stack)
        }
        Ok(setup)
    }
pub ( crate ) async fn build ( self ) -> Result < TestSetup , Error > { let mut setup = TestSetup :: new ( ) ? ; if ! self . endpoints . is_empty ( ) { let ( ) = setup . configure_network ( self . endpoints . into_iter ( ) ) . await ? ; } // configure all the stacks: for stack_cfg in self . stacks . into_iter ( ) { println ! ( " " stack_cfg ) ; let mut stack = TestStack :: new ( ) ; for ( ep_name , addr ) in stack_cfg . endpoints . into_iter ( ) { // get the endpoint from the sandbox config: let endpoint = setup . get_endpoint ( & ep_name ) . await ? ; let cli = stack . connect_stack ( ) ? ; let if_id = add_stack_endpoint ( & cli , endpoint ) . await ? ; // We'll ALWAYS await for the newly created interface to come up // online before returning, so users of `TestSetupBuilder` can // be 100% sure of the state once the setup is done. stack . wait_for_interface_online ( if_id ) . await ; if let Some ( addr ) = addr { configure_endpoint_address ( & cli , if_id , addr ) . await ? ; } assert_eq ! ( stack endpoint_ids insert ( ep_name if_id ) None ) ; } setup . add_stack ( stack ) } Ok ( setup ) }
Attempts to build a [`TestSetup`] with the provided configuration.
Attempts to build a [ ` TestSetup ` ] with the provided configuration .
self
self