diff --git a/container_prune_test.go b/container_prune_test.go index 5f06ea0664..55e551bb4b 100644 --- a/container_prune_test.go +++ b/container_prune_test.go @@ -40,6 +40,11 @@ func TestContainersPrune(t *testing.T) { danglingUntilFilters.Add("dangling", "true") danglingUntilFilters.Add("until", "2016-12-15T14:00") + labelFilters := filters.NewArgs() + labelFilters.Add("dangling", "true") + labelFilters.Add("label", "label1=foo") + labelFilters.Add("label", "label2!=bar") + listCases := []struct { filters filters.Args expectedQueryParams map[string]string @@ -76,6 +81,14 @@ func TestContainersPrune(t *testing.T) { "filters": `{"dangling":{"false":true}}`, }, }, + { + filters: labelFilters, + expectedQueryParams: map[string]string{ + "until": "", + "filter": "", + "filters": `{"dangling":{"true":true},"label":{"label1=foo":true,"label2!=bar":true}}`, + }, + }, } for _, listCase := range listCases { client := &Client{ diff --git a/image_prune_test.go b/image_prune_test.go index 68cd995d37..5dfb173acc 100644 --- a/image_prune_test.go +++ b/image_prune_test.go @@ -36,6 +36,11 @@ func TestImagesPrune(t *testing.T) { noDanglingFilters := filters.NewArgs() noDanglingFilters.Add("dangling", "false") + labelFilters := filters.NewArgs() + labelFilters.Add("dangling", "true") + labelFilters.Add("label", "label1=foo") + labelFilters.Add("label", "label2!=bar") + listCases := []struct { filters filters.Args expectedQueryParams map[string]string @@ -64,6 +69,14 @@ func TestImagesPrune(t *testing.T) { "filters": `{"dangling":{"false":true}}`, }, }, + { + filters: labelFilters, + expectedQueryParams: map[string]string{ + "until": "", + "filter": "", + "filters": `{"dangling":{"true":true},"label":{"label1=foo":true,"label2!=bar":true}}`, + }, + }, } for _, listCase := range listCases { client := &Client{ diff --git a/network_prune_test.go b/network_prune_test.go index 07a5d41f20..2bf4af4716 100644 --- a/network_prune_test.go +++ b/network_prune_test.go @@ -38,6 +38,11 @@ func TestNetworksPrune(t *testing.T) { noDanglingFilters := filters.NewArgs() noDanglingFilters.Add("dangling", "false") + labelFilters := filters.NewArgs() + labelFilters.Add("dangling", "true") + labelFilters.Add("label", "label1=foo") + labelFilters.Add("label", "label2!=bar") + listCases := []struct { filters filters.Args expectedQueryParams map[string]string @@ -66,6 +71,14 @@ func TestNetworksPrune(t *testing.T) { "filters": `{"dangling":{"false":true}}`, }, }, + { + filters: labelFilters, + expectedQueryParams: map[string]string{ + "until": "", + "filter": "", + "filters": `{"dangling":{"true":true},"label":{"label1=foo":true,"label2!=bar":true}}`, + }, + }, } for _, listCase := range listCases { client := &Client{