Skip to content

Commit

Permalink
cargo fmt 🤖
Browse files Browse the repository at this point in the history
  • Loading branch information
MGibson1 committed Sep 19, 2024
1 parent 67a4a2b commit efa931e
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 15 deletions.
28 changes: 21 additions & 7 deletions languages/language-tests/src/e2e_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ impl TestSecretData {
pub fn project_id(&self, projects: &[ProjectResponse]) -> Result<Uuid> {
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))?

Check warning on line 47 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L43-L47

Added lines #L43 - L47 were not covered by tests
.id;
Ok(id)
}

Check warning on line 50 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L49-L50

Added lines #L49 - L50 were not covered by tests

Expand All @@ -61,21 +63,33 @@ pub fn load_projects(run_id: &str, data_kind: DataKind) -> Result<Vec<TestProjec
let data = match data_kind {
DataKind::Mutable => load_data()?.mutable_projects,
DataKind::Immutable => load_data()?.projects,

Check warning on line 65 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L62-L65

Added lines #L62 - L65 were not covered by tests

};
Ok(data.iter().map(|project| project.with_run_id(run_id)).collect())
Ok(data
.iter()
.map(|project| project.with_run_id(run_id))
.collect())
}

Check warning on line 71 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L67-L71

Added lines #L67 - L71 were not covered by tests

pub fn load_secrets(run_id: &str, data_kind: DataKind) -> Result<Vec<TestSecretData>> {
let data = match data_kind {
DataKind::Mutable => load_data()?.mutable_secrets,
DataKind::Immutable => load_data()?.secrets,

Check warning on line 76 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L73-L76

Added lines #L73 - L76 were not covered by tests
};
Ok(data.iter().map(|secret| secret.with_run_id(run_id)).collect())
Ok(data
.iter()
.map(|secret| secret.with_run_id(run_id))
.collect())
}

Check warning on line 82 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L78-L82

Added lines #L78 - L82 were not covered by tests

pub fn load_realized_secrets(run_id: &str, loaded_projects: &[ProjectResponse], data_kind: DataKind) -> Result<Vec<RealizedTestSecretData>> {
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<Vec<RealizedTestSecretData>> {
load_secrets(run_id, data_kind)?
.iter()
.map(|secret| secret.realize(loaded_projects))
.collect()
}

Check warning on line 93 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L84-L93

Added lines #L84 - L93 were not covered by tests

fn load_data() -> Result<E2EData> {

Check warning on line 95 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L95

Added line #L95 was not covered by tests
Expand All @@ -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),
}
}

Check warning on line 119 in languages/language-tests/src/e2e_data.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/e2e_data.rs#L115-L119

Added lines #L115 - L119 were not covered by tests
}
Expand Down
42 changes: 34 additions & 8 deletions languages/language-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,43 @@ async fn clean_up_data(run_data: &RunData, data_kind: DataKind) -> Result<()> {
DataKind::Mutable => &run_data.mutable_client,

Check warning on line 254 in languages/language-tests/src/main.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/main.rs#L251-L254

Added lines #L251 - L254 were not covered by tests
};

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")?

Check warning on line 263 in languages/language-tests/src/main.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/main.rs#L257-L263

Added lines #L257 - L263 were not covered by tests
.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")?

Check warning on line 275 in languages/language-tests/src/main.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/main.rs#L265-L275

Added lines #L265 - L275 were not covered by tests
.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")?;

Check warning on line 293 in languages/language-tests/src/main.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/main.rs#L277-L293

Added lines #L277 - L293 were not covered by tests

Ok(())
}

Check warning on line 296 in languages/language-tests/src/main.rs

View check run for this annotation

Codecov / codecov/patch

languages/language-tests/src/main.rs#L295-L296

Added lines #L295 - L296 were not covered by tests

0 comments on commit efa931e

Please sign in to comment.