Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions helium_iceberg/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,72 @@ impl Default for HarnessConfig {
}
}

impl HarnessConfigBuilder {
/// Update only the host for s3_host_local
pub fn s3_host_local_host(mut self, host: impl Into<String>) -> Self {
if let Some(x) = self.s3_host_local.as_mut() {
x.set_host(host)
}
self
}

/// Update only the port for s3_host_local
pub fn s3_host_local_port(mut self, port: u16) -> Self {
if let Some(x) = self.s3_host_local.as_mut() {
x.set_port(port)
}
self
}

/// Update only the host for s3_host_qualified
pub fn s3_host_qualified_host(mut self, host: impl Into<String>) -> Self {
if let Some(x) = self.s3_host_qualified.as_mut() {
x.set_host(host)
}
self
}

/// Update only the port for s3_host_qualified
pub fn s3_host_qualified_port(mut self, port: u16) -> Self {
if let Some(x) = self.s3_host_qualified.as_mut() {
x.set_port(port)
}
self
}

/// Update only the host for catalog_host_local
pub fn catalog_host_local_host(mut self, host: impl Into<String>) -> Self {
if let Some(x) = self.catalog_host_local.as_mut() {
x.set_host(host)
}
self
}

/// Update only the port for catalog_host_local
pub fn catalog_host_local_port(mut self, port: u16) -> Self {
if let Some(x) = self.catalog_host_local.as_mut() {
x.set_port(port)
}
self
}

/// Update only the host for catalog_host_qualified
pub fn catalog_host_qualified_host(mut self, host: impl Into<String>) -> Self {
if let Some(x) = self.catalog_host_qualified.as_mut() {
x.set_host(host)
}
self
}

/// Update only the port for catalog_host_qualified
pub fn catalog_host_qualified_port(mut self, port: u16) -> Self {
if let Some(x) = self.catalog_host_qualified.as_mut() {
x.set_port(port)
}
self
}
}

impl HarnessConfig {
pub fn builder() -> HarnessConfigBuilder {
HarnessConfigBuilder::default()
Expand Down Expand Up @@ -606,6 +672,14 @@ impl TestHost {
}
}

fn set_host(&mut self, host: impl Into<String>) {
self.host = host.into();
}

fn set_port(&mut self, port: u16) {
self.port = port;
}

fn with_path(&self, path: &str) -> String {
format!("http://{}:{}{path}", self.host, self.port)
}
Expand Down
Loading