From efa931e2aa521d7bc4dbb18b3ed30f8eefbb2335 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Thu, 19 Sep 2024 09:24:09 -0700 Subject: [PATCH] `cargo fmt` :robot: --- languages/language-tests/src/e2e_data.rs | 28 ++++++++++++---- languages/language-tests/src/main.rs | 42 +++++++++++++++++++----- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/languages/language-tests/src/e2e_data.rs b/languages/language-tests/src/e2e_data.rs index 192471d26..e2d1d0efe 100644 --- a/languages/language-tests/src/e2e_data.rs +++ b/languages/language-tests/src/e2e_data.rs @@ -43,7 +43,9 @@ impl TestSecretData { pub fn project_id(&self, projects: &[ProjectResponse]) -> Result { let id = projects .iter() - .find(|p| p.name == self.project_name).context(format!("Project, {}, not found", self.project_name))?.id; + .find(|p| p.name == self.project_name) + .context(format!("Project, {}, not found", self.project_name))? + .id; Ok(id) } @@ -61,9 +63,11 @@ pub fn load_projects(run_id: &str, data_kind: DataKind) -> Result load_data()?.mutable_projects, DataKind::Immutable => load_data()?.projects, - }; - Ok(data.iter().map(|project| project.with_run_id(run_id)).collect()) + Ok(data + .iter() + .map(|project| project.with_run_id(run_id)) + .collect()) } pub fn load_secrets(run_id: &str, data_kind: DataKind) -> Result> { @@ -71,11 +75,21 @@ pub fn load_secrets(run_id: &str, data_kind: DataKind) -> Result load_data()?.mutable_secrets, DataKind::Immutable => load_data()?.secrets, }; - Ok(data.iter().map(|secret| secret.with_run_id(run_id)).collect()) + Ok(data + .iter() + .map(|secret| secret.with_run_id(run_id)) + .collect()) } -pub fn load_realized_secrets(run_id: &str, loaded_projects: &[ProjectResponse], data_kind: DataKind) -> Result> { - load_secrets(run_id, data_kind)?.iter().map(|secret| secret.realize(loaded_projects)).collect() +pub fn load_realized_secrets( + run_id: &str, + loaded_projects: &[ProjectResponse], + data_kind: DataKind, +) -> Result> { + load_secrets(run_id, data_kind)? + .iter() + .map(|secret| secret.realize(loaded_projects)) + .collect() } fn load_data() -> Result { @@ -100,7 +114,7 @@ impl RunIdNotation for String { impl RunIdNotation for TestProjectData { fn with_run_id(&self, run_id: &str) -> Self { Self { - name: self.name.with_run_id(run_id) + name: self.name.with_run_id(run_id), } } } diff --git a/languages/language-tests/src/main.rs b/languages/language-tests/src/main.rs index fd372e9e6..d3e83fa18 100644 --- a/languages/language-tests/src/main.rs +++ b/languages/language-tests/src/main.rs @@ -254,17 +254,43 @@ async fn clean_up_data(run_data: &RunData, data_kind: DataKind) -> Result<()> { DataKind::Mutable => &run_data.mutable_client, }; - let secrets: Vec<_> = client.secrets().list(&SecretIdentifiersRequest { - organization_id: run_data.organization_id, - }).await.context("Failed to list secrets")?.data.iter().filter(|s| s.key.ends_with(&run_data.run_id)).map(|s| s.id).collect(); - let projects: Vec<_> = client.projects().list(&ProjectsListRequest { - organization_id: run_data.organization_id, - }).await.context("Failed to list projects")?.data.iter().filter(|p| p.name.ends_with(&run_data.run_id)).map(|p| p.id).collect(); + let secrets: Vec<_> = client + .secrets() + .list(&SecretIdentifiersRequest { + organization_id: run_data.organization_id, + }) + .await + .context("Failed to list secrets")? + .data + .iter() + .filter(|s| s.key.ends_with(&run_data.run_id)) + .map(|s| s.id) + .collect(); + let projects: Vec<_> = client + .projects() + .list(&ProjectsListRequest { + organization_id: run_data.organization_id, + }) + .await + .context("Failed to list projects")? + .data + .iter() + .filter(|p| p.name.ends_with(&run_data.run_id)) + .map(|p| p.id) + .collect(); println!("Deleting secrets: {:?}", secrets); - client.secrets().delete(SecretsDeleteRequest { ids: secrets }).await.context("Failed to delete secrets")?; + client + .secrets() + .delete(SecretsDeleteRequest { ids: secrets }) + .await + .context("Failed to delete secrets")?; println!("Deleting projects: {:?}", projects); - client.projects().delete(ProjectsDeleteRequest { ids: projects }).await.context("Failed to delete projects")?; + client + .projects() + .delete(ProjectsDeleteRequest { ids: projects }) + .await + .context("Failed to delete projects")?; Ok(()) }