pub struct EphemeralTestnet {
pub testnet: Testnet,
}Expand description
A simple testnet with random ports assigned for all components.
Components included:
- A local DHT with bootstrapping nodes.
- A homeserver (default pubkey:
8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo). - An HTTP relay (optional, use
.with_http_relay()to enable).
§Recommended Usage
Use EphemeralTestnet::builder() to create a testnet with explicit configuration:
// Minimal testnet (admin/metrics disabled) - fastest for most tests
let testnet = EphemeralTestnet::builder().build().await?;
// Full-featured testnet (admin enabled) - for tests requiring admin API
let testnet = EphemeralTestnet::builder()
.config(ConfigToml::default_test_config())
.build()
.await?;§Configuration Defaults
- [
EphemeralTestnet::builder().build()] usesConfigToml::minimal_test_config()(admin/metrics disabled) - Deprecated
EphemeralTestnet::start()usesConfigToml::default_test_config()(admin enabled)
Fields§
§testnet: TestnetInner flexible testnet.
Implementations§
Source§impl EphemeralTestnet
impl EphemeralTestnet
Sourcepub fn builder() -> EphemeralTestnetBuilder
pub fn builder() -> EphemeralTestnetBuilder
Sourcepub async fn start() -> Result<Self>
👎Deprecated since 0.5.0: Use EphemeralTestnet::builder().config(ConfigToml::default_test_config()).build() for explicit behavior
pub async fn start() -> Result<Self>
Use EphemeralTestnet::builder().config(ConfigToml::default_test_config()).build() for explicit behavior
Run a new simple testnet with full config (admin enabled).
§Deprecated
Use Self::builder() for explicit configuration control.
This method uses ConfigToml::default_test_config() which enables the admin server.
Sourcepub async fn start_with_custom_postgres(
postgres_connection_string: ConnectionString,
) -> Result<Self>
👎Deprecated since 0.5.0: Use EphemeralTestnet::builder().postgres(…).config(ConfigToml::default_test_config()).build() instead
pub async fn start_with_custom_postgres( postgres_connection_string: ConnectionString, ) -> Result<Self>
Use EphemeralTestnet::builder().postgres(…).config(ConfigToml::default_test_config()).build() instead
Run a new simple testnet with custom postgres and full config (admin enabled).
§Deprecated
Use Self::builder() with .postgres() for explicit configuration control.
Sourcepub async fn start_minimal_with_custom_postgres(
postgres_connection_string: ConnectionString,
) -> Result<Self>
👎Deprecated since 0.5.0: Use Testnet::new_with_custom_postgres() and create_http_relay() for fine-grained control
pub async fn start_minimal_with_custom_postgres( postgres_connection_string: ConnectionString, ) -> Result<Self>
Use Testnet::new_with_custom_postgres() and create_http_relay() for fine-grained control
Sourcepub async fn start_minimal() -> Result<Self>
👎Deprecated since 0.5.0: Use Testnet::new() and create_http_relay() for fine-grained control
pub async fn start_minimal() -> Result<Self>
Use Testnet::new() and create_http_relay() for fine-grained control
Sourcepub async fn create_random_homeserver(&mut self) -> Result<&HomeserverApp>
pub async fn create_random_homeserver(&mut self) -> Result<&HomeserverApp>
Create an additional homeserver with a random keypair.
Sourcepub async fn create_random_homeserver_with_config(
&mut self,
config: Option<ConfigToml>,
) -> Result<&HomeserverApp>
pub async fn create_random_homeserver_with_config( &mut self, config: Option<ConfigToml>, ) -> Result<&HomeserverApp>
Create an additional homeserver with a random keypair and custom config. Uses minimal_test_config() by default (admin/metrics disabled).
Sourcepub fn client_builder(&self) -> PubkyHttpClientBuilder
pub fn client_builder(&self) -> PubkyHttpClientBuilder
Create a new pubky client builder.
Sourcepub fn client(&self) -> Result<PubkyHttpClient, BuildError>
pub fn client(&self) -> Result<PubkyHttpClient, BuildError>
Creates a pubky::PubkyHttpClient pre-configured to use this test network.
Sourcepub fn sdk(&self) -> Result<Pubky, BuildError>
pub fn sdk(&self) -> Result<Pubky, BuildError>
Creates a pubky::Pubky SDK facade pre-configured to use this test network.
This is a convenience method that builds a client from Self::client_builder.
Sourcepub fn pkarr_client_builder(&self) -> ClientBuilder
pub fn pkarr_client_builder(&self) -> ClientBuilder
Create a new pkarr client builder.
Sourcepub fn homeserver_app(&self) -> &HomeserverApp
pub fn homeserver_app(&self) -> &HomeserverApp
Get the homeserver in the testnet.
Sourcepub fn http_relay(&self) -> &HttpRelay
pub fn http_relay(&self) -> &HttpRelay
Get the http relay in the testnet.
Auto Trait Implementations§
impl Freeze for EphemeralTestnet
impl !RefUnwindSafe for EphemeralTestnet
impl Send for EphemeralTestnet
impl Sync for EphemeralTestnet
impl Unpin for EphemeralTestnet
impl UnsafeUnpin for EphemeralTestnet
impl !UnwindSafe for EphemeralTestnet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request