Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all filter to fix prune behaviour in docker 23 #348

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/image_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ ENTRYPOINT ls buildkit-bollard.txt
}
})
.any(|status| status.id
== "naming to docker.io/library/integration_test_build_buildkit_image"));
== "naming to docker.io/library/integration_test_build_buildkit_image:latest"));

let _ = &docker
.create_container(
Expand Down
22 changes: 3 additions & 19 deletions tests/volume_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> {
// --

let mut prune_volumes_filters = HashMap::new();
if cfg!(not(windows)) {
prune_volumes_filters.insert("all", vec!["true"]);
}
prune_volumes_filters.insert("label!", vec!["maintainer=bollard-maintainer"]);

let prune_volumes_options = PruneVolumesOptions {
Expand Down Expand Up @@ -150,27 +153,8 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> {

let results = &docker.list_volumes::<String>(None).await?;

let mut expected_results_label = HashMap::new();
expected_results_label.insert(
String::from("maintainer"),
String::from("bollard-maintainer"),
);

assert_ne!(0, results.volumes.as_ref().unwrap().len());

// we need to filter the results, because volumes without a label are not pruned
assert_eq!(
&expected_results_label,
&results
.volumes
.as_ref()
.unwrap()
.iter()
.find(|v| !v.labels.is_empty())
.unwrap()
.labels
);

let remove_volume_options = RemoveVolumeOptions { force: true };
let _ = &docker
.remove_volume(
Expand Down