@@ -26,7 +26,7 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
2626 expectedAll bool
2727 expectedSize bool
2828 expectedLimit int
29- expectedFilters map [ string ] string
29+ expectedFilters client. Filters
3030 }{
3131 {
3232 psOpts : & psOptions {
@@ -35,13 +35,10 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
3535 last : 5 ,
3636 filter : filters ,
3737 },
38- expectedAll : true ,
39- expectedSize : true ,
40- expectedLimit : 5 ,
41- expectedFilters : map [string ]string {
42- "foo" : "bar" ,
43- "baz" : "foo" ,
44- },
38+ expectedAll : true ,
39+ expectedSize : true ,
40+ expectedLimit : 5 ,
41+ expectedFilters : make (client.Filters ).Add ("foo" , "bar" ).Add ("baz" , "foo" ),
4542 },
4643 {
4744 psOpts : & psOptions {
@@ -50,10 +47,9 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
5047 last : - 1 ,
5148 nLatest : true ,
5249 },
53- expectedAll : true ,
54- expectedSize : true ,
55- expectedLimit : 1 ,
56- expectedFilters : make (map [string ]string ),
50+ expectedAll : true ,
51+ expectedSize : true ,
52+ expectedLimit : 1 ,
5753 },
5854 {
5955 psOpts : & psOptions {
@@ -64,13 +60,10 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
6460 // With .Size, size should be true
6561 format : "{{.Size}}" ,
6662 },
67- expectedAll : true ,
68- expectedSize : true ,
69- expectedLimit : 5 ,
70- expectedFilters : map [string ]string {
71- "foo" : "bar" ,
72- "baz" : "foo" ,
73- },
63+ expectedAll : true ,
64+ expectedSize : true ,
65+ expectedLimit : 5 ,
66+ expectedFilters : make (client.Filters ).Add ("foo" , "bar" ).Add ("baz" , "foo" ),
7467 },
7568 {
7669 psOpts : & psOptions {
@@ -81,13 +74,10 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
8174 // With .Size, size should be true
8275 format : "{{.Size}} {{.CreatedAt}} {{upper .Networks}}" ,
8376 },
84- expectedAll : true ,
85- expectedSize : true ,
86- expectedLimit : 5 ,
87- expectedFilters : map [string ]string {
88- "foo" : "bar" ,
89- "baz" : "foo" ,
90- },
77+ expectedAll : true ,
78+ expectedSize : true ,
79+ expectedLimit : 5 ,
80+ expectedFilters : make (client.Filters ).Add ("foo" , "bar" ).Add ("baz" , "foo" ),
9181 },
9282 {
9383 psOpts : & psOptions {
@@ -98,13 +88,10 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
9888 // Without .Size, size should be false
9989 format : "{{.CreatedAt}} {{.Networks}}" ,
10090 },
101- expectedAll : true ,
102- expectedSize : false ,
103- expectedLimit : 5 ,
104- expectedFilters : map [string ]string {
105- "foo" : "bar" ,
106- "baz" : "foo" ,
107- },
91+ expectedAll : true ,
92+ expectedSize : false ,
93+ expectedLimit : 5 ,
94+ expectedFilters : make (client.Filters ).Add ("foo" , "bar" ).Add ("baz" , "foo" ),
10895 },
10996 }
11097
@@ -115,14 +102,7 @@ func TestContainerListBuildContainerListOptions(t *testing.T) {
115102 assert .Check (t , is .Equal (c .expectedAll , options .All ))
116103 assert .Check (t , is .Equal (c .expectedSize , options .Size ))
117104 assert .Check (t , is .Equal (c .expectedLimit , options .Limit ))
118- assert .Check (t , is .Equal (len (c .expectedFilters ), options .Filters .Len ()))
119-
120- for k , v := range c .expectedFilters {
121- f := options .Filters
122- if ! f .ExactMatch (k , v ) {
123- t .Fatalf ("Expected filter with key %s to be %s but got %s" , k , v , f .Get (k ))
124- }
125- }
105+ assert .Check (t , is .DeepEqual (c .expectedFilters , options .Filters ))
126106 }
127107}
128108
0 commit comments