Skip to content

Commit

Permalink
improve test_healthy_providers_return_healthy_status unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Vikrant Palle <[email protected]>
  • Loading branch information
Vikrantpalle authored and brooksmtownsend committed Dec 23, 2024
1 parent df0bf72 commit 062130e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
30 changes: 29 additions & 1 deletion crates/wadm/src/scaler/daemonscaler/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ mod test {
issuer: "issuer".to_string(),
reference: provider_ref.to_string(),
hosts: HashMap::from([
(host_id_one.to_string(), ProviderStatus::Pending),
(host_id_one.to_string(), ProviderStatus::Failed),
(host_id_two.to_string(), ProviderStatus::Running),
]),
},
Expand Down Expand Up @@ -667,6 +667,34 @@ mod test {
);

spreadscaler.reconcile().await?;
spreadscaler
.handle_event(&Event::ProviderHealthCheckFailed(
ProviderHealthCheckFailed {
data: ProviderHealthCheckInfo {
provider_id: provider_id.to_string(),
host_id: host_id_one.to_string(),
},
},
))
.await?;

store
.store(
lattice_id,
provider_id.to_string(),
Provider {
id: provider_id.to_string(),
name: "provider".to_string(),
issuer: "issuer".to_string(),
reference: provider_ref.to_string(),
hosts: HashMap::from([
(host_id_one.to_string(), ProviderStatus::Pending),
(host_id_two.to_string(), ProviderStatus::Running),
]),
},
)
.await?;

spreadscaler
.handle_event(&&Event::ProviderHealthCheckPassed(
ProviderHealthCheckPassed {
Expand Down
30 changes: 29 additions & 1 deletion crates/wadm/src/scaler/spreadscaler/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,14 +1360,42 @@ mod test {
issuer: "issuer".to_string(),
reference: provider_ref.to_string(),
hosts: HashMap::from([
(host_id_one.to_string(), ProviderStatus::Pending),
(host_id_one.to_string(), ProviderStatus::Failed),
(host_id_two.to_string(), ProviderStatus::Running),
]),
},
)
.await?;

spreadscaler.reconcile().await?;
spreadscaler
.handle_event(&Event::ProviderHealthCheckFailed(
ProviderHealthCheckFailed {
data: ProviderHealthCheckInfo {
provider_id: provider_id.to_string(),
host_id: host_id_one.to_string(),
},
},
))
.await?;

store
.store(
lattice_id,
provider_id.to_string(),
Provider {
id: provider_id.to_string(),
name: "provider".to_string(),
issuer: "issuer".to_string(),
reference: provider_ref.to_string(),
hosts: HashMap::from([
(host_id_one.to_string(), ProviderStatus::Pending),
(host_id_two.to_string(), ProviderStatus::Running),
]),
},
)
.await?;

spreadscaler
.handle_event(&&Event::ProviderHealthCheckPassed(
ProviderHealthCheckPassed {
Expand Down

0 comments on commit 062130e

Please sign in to comment.