Skip to content

Commit b84efcd

Browse files
committed
test: added relay api tests
1 parent a00fc68 commit b84efcd

3 files changed

Lines changed: 527 additions & 1 deletion

File tree

rust/main/agents/relayer/src/relay_api/handlers.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ pub struct TxHashCache {
3232

3333
impl TxHashCache {
3434
pub fn new(max_entries: usize) -> Self {
35+
Self::new_with_ttl(max_entries, Duration::from_secs(300))
36+
}
37+
38+
pub fn new_with_ttl(max_entries: usize, ttl: Duration) -> Self {
3539
Self {
3640
cache: HashMap::new(),
3741
max_entries,
38-
ttl: Duration::from_secs(300), // 5 minutes
42+
ttl,
3943
}
4044
}
4145

rust/main/agents/relayer/src/relay_api/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ pub mod metrics;
55
pub use extractor::{extract_messages, ExtractedMessage};
66
pub use handlers::ServerState;
77
pub use metrics::RelayApiMetrics;
8+
9+
#[cfg(test)]
10+
mod tests;

0 commit comments

Comments
 (0)