@@ -36,12 +36,38 @@ var _ = Describe("ListOptions", func() {
3636 o .ApplyToList (newListOpts )
3737 Expect (newListOpts ).To (Equal (o ))
3838 })
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+ })
3953 It ("Should set FieldSelector" , func () {
4054 o := & client.ListOptions {FieldSelector : fields .Nothing ()}
4155 newListOpts := & client.ListOptions {}
4256 o .ApplyToList (newListOpts )
4357 Expect (newListOpts ).To (Equal (o ))
4458 })
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+ })
4571 It ("Should set Namespace" , func () {
4672 o := & client.ListOptions {Namespace : "my-ns" }
4773 newListOpts := & client.ListOptions {}
0 commit comments