Skip to content

Commit 5c5d201

Browse files
committed
boundimage: Rename helper function
I think this name is a bit clearer. Signed-off-by: Colin Walters <[email protected]>
1 parent fcc2005 commit 5c5d201

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/src/boundimage.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ struct BoundImage {
3232
/// Given a deployment, pull all container images it references.
3333
pub(crate) fn pull_bound_images(sysroot: &SysrootLock, deployment: &Deployment) -> Result<()> {
3434
let deployment_root = &crate::utils::deployment_fd(sysroot, deployment)?;
35-
let bound_images = parse_spec_dir(deployment_root)?;
35+
let bound_images = query_bound_images(deployment_root)?;
3636
pull_images(deployment_root, bound_images)
3737
}
3838

39-
#[context("parse bound image spec dir")]
40-
fn parse_spec_dir(root: &Dir) -> Result<Vec<BoundImage>> {
39+
#[context("Querying bound images")]
40+
fn query_bound_images(root: &Dir) -> Result<Vec<BoundImage>> {
4141
let spec_dir = BOUND_IMAGE_DIR;
4242
let Some(bound_images_dir) = root.open_dir_optional(spec_dir)? else {
4343
tracing::debug!("Missing {spec_dir}");
@@ -179,12 +179,12 @@ mod tests {
179179

180180
// Empty dir should return an empty vector
181181
let td = &cap_std_ext::cap_tempfile::TempDir::new(cap_std::ambient_authority())?;
182-
let images = parse_spec_dir(td).unwrap();
182+
let images = query_bound_images(td).unwrap();
183183
assert_eq!(images.len(), 0);
184184

185185
td.create_dir_all(BOUND_IMAGE_DIR).unwrap();
186186
td.create_dir_all(CONTAINER_IMAGE_DIR).unwrap();
187-
let images = parse_spec_dir(td).unwrap();
187+
let images = query_bound_images(td).unwrap();
188188
assert_eq!(images.len(), 0);
189189

190190
// Should return BoundImages
@@ -216,7 +216,7 @@ mod tests {
216216
)
217217
.unwrap();
218218

219-
let mut images = parse_spec_dir(td).unwrap();
219+
let mut images = query_bound_images(td).unwrap();
220220
images.sort_by(|a, b| a.image.as_str().cmp(&b.image.as_str()));
221221
assert_eq!(images.len(), 2);
222222
assert_eq!(images[0].image, "quay.io/bar/bar:latest");
@@ -225,13 +225,13 @@ mod tests {
225225
// Invalid symlink should return an error
226226
td.symlink("./blah", format!("{BOUND_IMAGE_DIR}/blah.image"))
227227
.unwrap();
228-
assert!(parse_spec_dir(td).is_err());
228+
assert!(query_bound_images(td).is_err());
229229

230230
// Invalid image contents should return an error
231231
td.write("error.image", "[Image]\n").unwrap();
232232
td.symlink_contents("/error.image", format!("{BOUND_IMAGE_DIR}/error.image"))
233233
.unwrap();
234-
assert!(parse_spec_dir(td).is_err());
234+
assert!(query_bound_images(td).is_err());
235235

236236
Ok(())
237237
}

0 commit comments

Comments
 (0)