@@ -36,12 +36,38 @@ var _ = Describe("ListOptions", func() {
36
36
o .ApplyToList (newListOpts )
37
37
Expect (newListOpts ).To (Equal (o ))
38
38
})
39
+ It ("Should set LabelSelector with MatchingLabelsSelector" , func () {
40
+ labelSelector , err := labels .Parse ("a=b" )
41
+ Expect (err ).NotTo (HaveOccurred ())
42
+ newListOpts := & client.ListOptions {}
43
+ newListOpts .ApplyOptions ([]client.ListOption {client.MatchingLabelsSelector {Selector : labelSelector }})
44
+ expectedListOpts := & client.ListOptions {LabelSelector : client.MatchingLabelsSelector {Selector : labelSelector }}
45
+ Expect (newListOpts ).To (Equal (expectedListOpts ))
46
+ })
47
+ It ("Should set LabelSelector to nothing with empty MatchingLabelsSelector" , func () {
48
+ newListOpts := & client.ListOptions {}
49
+ newListOpts .ApplyOptions ([]client.ListOption {client.MatchingLabelsSelector {}})
50
+ expectedListOpts := & client.ListOptions {LabelSelector : client.MatchingLabelsSelector {Selector : labels .Nothing ()}}
51
+ Expect (newListOpts ).To (Equal (expectedListOpts ))
52
+ })
39
53
It ("Should set FieldSelector" , func () {
40
54
o := & client.ListOptions {FieldSelector : fields .Nothing ()}
41
55
newListOpts := & client.ListOptions {}
42
56
o .ApplyToList (newListOpts )
43
57
Expect (newListOpts ).To (Equal (o ))
44
58
})
59
+ It ("Should set FieldSelector with MatchingFieldsSelector" , func () {
60
+ newListOpts := & client.ListOptions {}
61
+ newListOpts .ApplyOptions ([]client.ListOption {client.MatchingFieldsSelector {Selector : fields .Nothing ()}})
62
+ expectedListOpts := & client.ListOptions {FieldSelector : client.MatchingFieldsSelector {Selector : fields .Nothing ()}}
63
+ Expect (newListOpts ).To (Equal (expectedListOpts ))
64
+ })
65
+ It ("Should set FieldSelector to nothing with empty MatchingFieldsSelector" , func () {
66
+ newListOpts := & client.ListOptions {}
67
+ newListOpts .ApplyOptions ([]client.ListOption {client.MatchingFieldsSelector {}})
68
+ expectedListOpts := & client.ListOptions {FieldSelector : client.MatchingFieldsSelector {Selector : fields .Nothing ()}}
69
+ Expect (newListOpts ).To (Equal (expectedListOpts ))
70
+ })
45
71
It ("Should set Namespace" , func () {
46
72
o := & client.ListOptions {Namespace : "my-ns" }
47
73
newListOpts := & client.ListOptions {}
0 commit comments