Skip to content

Commit b3e4235

Browse files
committed
test(providers): isolate attach limit fixtures
1 parent fab848c commit b3e4235

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

crates/openshell-server/src/grpc/sandbox.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,6 +2083,14 @@ mod tests {
20832083
}
20842084

20852085
fn test_provider(name: &str, provider_type: &str) -> Provider {
2086+
test_provider_with_credential_key(name, provider_type, "TOKEN")
2087+
}
2088+
2089+
fn test_provider_with_credential_key(
2090+
name: &str,
2091+
provider_type: &str,
2092+
credential_key: &str,
2093+
) -> Provider {
20862094
Provider {
20872095
metadata: Some(ObjectMeta {
20882096
id: format!("provider-{name}"),
@@ -2092,7 +2100,8 @@ mod tests {
20922100
resource_version: 0,
20932101
}),
20942102
r#type: provider_type.to_string(),
2095-
credentials: std::iter::once(("TOKEN".to_string(), "secret".to_string())).collect(),
2103+
credentials: std::iter::once((credential_key.to_string(), "secret".to_string()))
2104+
.collect(),
20962105
config: HashMap::new(),
20972106
credential_expires_at_ms: HashMap::new(),
20982107
}
@@ -2530,7 +2539,11 @@ mod tests {
25302539
for i in 0..MAX_PROVIDERS {
25312540
state
25322541
.store
2533-
.put_message(&test_provider(&format!("provider-{i}"), "generic"))
2542+
.put_message(&test_provider_with_credential_key(
2543+
&format!("provider-{i}"),
2544+
"generic",
2545+
&format!("TOKEN_{i}"),
2546+
))
25342547
.await
25352548
.unwrap();
25362549
}
@@ -2580,7 +2593,11 @@ mod tests {
25802593
for i in 0..=MAX_PROVIDERS {
25812594
state
25822595
.store
2583-
.put_message(&test_provider(&format!("provider-{i}"), "generic"))
2596+
.put_message(&test_provider_with_credential_key(
2597+
&format!("provider-{i}"),
2598+
"generic",
2599+
&format!("TOKEN_{i}"),
2600+
))
25842601
.await
25852602
.unwrap();
25862603
}
@@ -3045,7 +3062,11 @@ mod tests {
30453062
for i in 0..3 {
30463063
state
30473064
.store
3048-
.put_message(&test_provider(&format!("provider-{i}"), "generic"))
3065+
.put_message(&test_provider_with_credential_key(
3066+
&format!("provider-{i}"),
3067+
"generic",
3068+
&format!("TOKEN_{i}"),
3069+
))
30493070
.await
30503071
.unwrap();
30513072
}

0 commit comments

Comments
 (0)