k8s_test_framework

Struct PortForwarder

Source
pub struct PortForwarder { /* private fields */ }
Expand description

Keeps track of the continuously running kubectl port-forward command, exposing the API to terminate it when needed.

Implementations§

Source§

impl PortForwarder

Source

pub async fn wait_until_ready(&mut self) -> Result<(), Box<dyn Error>>

Waits for port forward process to start listening on IPv4 and IPv6 local sockets.

Source

pub fn local_port(&self) -> u16

Returns the local port that port forward was requested to listen on.

Source

pub fn resource_port(&self) -> u16

Returns the resource port that port forward was requested to forward to.

Source

pub fn local_addr_ipv4(&self) -> String

Returns the local address (in the “host:port” form) to connect to in order to reach the cluster resource port, at the IPv4 address family.

Source

pub fn local_addr_ipv6(&self) -> String

Returns the local address (in the “host:port” form) to connect to in order to reach the cluster resource port, at the IPv6 address family.

Source

pub async fn wait(&mut self) -> Result<ExitStatus>

Wait for the kubectl port-forward process to exit and return the exit code.

Source

pub async fn kill(&mut self) -> Result<()>

Send a termination signal to the kubectl port-forward process.

Trait Implementations§

Source§

impl Debug for PortForwarder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.