Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Nov 18, 2024
1 parent 593cf6c commit 6eda85c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions rs/tests/driver/src/driver/test_env_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1138,10 +1138,12 @@ pub fn get_elasticsearch_hosts() -> Result<Vec<String>> {
parse_elasticsearch_hosts(Some(hosts))
}


/// Helper function to figure out SHA256 from a CAS url
pub fn get_sha256_from_cas_url(bar: &str, url: &Url) -> Result<String> {
let (_prefix, sha256) = url.path().rsplit_once('/').ok_or(anyhow!("failed to extract sha256 from CAS url '{url}'"))?;
let (_prefix, sha256) = url
.path()
.rsplit_once('/')
.ok_or(anyhow!("failed to extract sha256 from CAS url '{url}'"))?;
let sha256 = sha256.to_string();
bail_if_sha256_invalid(&sha256, bar)?;
Ok(sha256.to_string())
Expand Down Expand Up @@ -1191,7 +1193,10 @@ pub fn get_malicious_ic_os_update_img_url() -> Result<Url> {
}

pub fn get_malicious_ic_os_update_img_sha256() -> Result<String> {
get_sha256_from_cas_url("ic_os_update_img_sha256", &get_malicious_ic_os_update_img_url()?)
get_sha256_from_cas_url(
"ic_os_update_img_sha256",
&get_malicious_ic_os_update_img_url()?,
)
}

pub fn get_boundary_node_img_url() -> Result<Url> {
Expand Down Expand Up @@ -1226,7 +1231,10 @@ pub fn get_hostos_update_img_test_url() -> Result<Url> {
}

pub fn get_hostos_update_img_test_sha256() -> Result<String> {
get_sha256_from_cas_url("hostos_update_img_sha256", &get_hostos_update_img_test_url()?)
get_sha256_from_cas_url(
"hostos_update_img_sha256",
&get_hostos_update_img_test_url()?,
)
}

pub const FETCH_SHA256SUMS_RETRY_TIMEOUT: Duration = Duration::from_secs(120);
Expand Down

0 comments on commit 6eda85c

Please sign in to comment.