Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 0 additions & 26 deletions crates/remote-signer/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,30 +394,4 @@ mod integration_tests {
}
}
}

#[tokio::test]
async fn config_builder_pattern() {
let config = RemoteSigningConfig::default()
.with_timeout(Duration::from_secs(10))
.with_retry_config(RetryConfig::new(
2,
Duration::from_millis(50),
Duration::from_secs(1),
));

assert_eq!(config.endpoint, "http://0.0.0.0:10340");
assert_eq!(config.timeout, Duration::from_secs(10));
assert_eq!(config.retry_config.max_retries, 2);
}

#[tokio::test]
async fn retry_config_validation() {
let retry_config = RetryConfig::new(5, Duration::from_millis(100), Duration::from_secs(10))
.with_backoff_multiplier(1.5);

assert_eq!(retry_config.max_retries, 5);
assert_eq!(retry_config.initial_backoff, Duration::from_millis(100));
assert_eq!(retry_config.max_backoff, Duration::from_secs(10));
assert_eq!(retry_config.backoff_multiplier, 1.5);
}
}
26 changes: 26 additions & 0 deletions crates/remote-signer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,30 @@ mod tests {
};
assert!(config.validate().is_ok());
}

#[tokio::test]
Comment thread
ikwuoz marked this conversation as resolved.
Outdated
async fn config_builder_pattern() {
Comment thread
ikwuoz marked this conversation as resolved.
Outdated
let config = RemoteSigningConfig::default()
.with_timeout(Duration::from_secs(10))
.with_retry_config(RetryConfig::new(
2,
Duration::from_millis(50),
Duration::from_secs(1),
));

assert_eq!(config.endpoint, "http://0.0.0.0:10340");
assert_eq!(config.timeout, Duration::from_secs(10));
assert_eq!(config.retry_config.max_retries, 2);
}

#[tokio::test]
Comment thread
ikwuoz marked this conversation as resolved.
Outdated
async fn retry_config_validation() {
Comment thread
ikwuoz marked this conversation as resolved.
Outdated
let retry_config = RetryConfig::new(5, Duration::from_millis(100), Duration::from_secs(10))
.with_backoff_multiplier(1.5);

assert_eq!(retry_config.max_retries, 5);
assert_eq!(retry_config.initial_backoff, Duration::from_millis(100));
assert_eq!(retry_config.max_backoff, Duration::from_secs(10));
assert_eq!(retry_config.backoff_multiplier, 1.5);
}
}