@@ -2000,7 +2000,7 @@ var _ = Describe("Client", func() {
2000
2000
Describe ("CreateOptions" , func () {
2001
2001
It ("should allow setting DryRun to 'all'" , func () {
2002
2002
co := & client.CreateOptions {}
2003
- client .CreateDryRunAll (co )
2003
+ client .DryRunAll . ApplyToCreate (co )
2004
2004
all := []string {metav1 .DryRunAll }
2005
2005
Expect (co .AsCreateOptions ().DryRun ).To (Equal (all ))
2006
2006
})
@@ -2016,22 +2016,22 @@ var _ = Describe("Client", func() {
2016
2016
Describe ("DeleteOptions" , func () {
2017
2017
It ("should allow setting GracePeriodSeconds" , func () {
2018
2018
do := & client.DeleteOptions {}
2019
- client .GracePeriodSeconds (1 )(do )
2019
+ client .GracePeriodSeconds (1 ). ApplyToDelete (do )
2020
2020
gp := int64 (1 )
2021
2021
Expect (do .AsDeleteOptions ().GracePeriodSeconds ).To (Equal (& gp ))
2022
2022
})
2023
2023
2024
2024
It ("should allow setting Precondition" , func () {
2025
2025
do := & client.DeleteOptions {}
2026
2026
pc := metav1 .NewUIDPreconditions ("uid" )
2027
- client .Preconditions (pc )(do )
2027
+ client .Preconditions (* pc ). ApplyToDelete (do )
2028
2028
Expect (do .AsDeleteOptions ().Preconditions ).To (Equal (pc ))
2029
2029
Expect (do .Preconditions ).To (Equal (pc ))
2030
2030
})
2031
2031
2032
2032
It ("should allow setting PropagationPolicy" , func () {
2033
2033
do := & client.DeleteOptions {}
2034
- client .PropagationPolicy (metav1 .DeletePropagationForeground )(do )
2034
+ client .PropagationPolicy (metav1 .DeletePropagationForeground ). ApplyToDelete (do )
2035
2035
dp := metav1 .DeletePropagationForeground
2036
2036
Expect (do .AsDeleteOptions ().PropagationPolicy ).To (Equal (& dp ))
2037
2037
})
@@ -2048,9 +2048,9 @@ var _ = Describe("Client", func() {
2048
2048
pc := metav1 .NewUIDPreconditions ("uid" )
2049
2049
dp := metav1 .DeletePropagationForeground
2050
2050
do := & client.DeleteOptions {}
2051
- do .ApplyOptions ([]client.DeleteOptionFunc {
2051
+ do .ApplyOptions ([]client.DeleteOption {
2052
2052
client .GracePeriodSeconds (gp ),
2053
- client .Preconditions (pc ),
2053
+ client .Preconditions (* pc ),
2054
2054
client .PropagationPolicy (dp ),
2055
2055
})
2056
2056
Expect (do .GracePeriodSeconds ).To (Equal (& gp ))
@@ -2060,79 +2060,35 @@ var _ = Describe("Client", func() {
2060
2060
})
2061
2061
2062
2062
Describe ("ListOptions" , func () {
2063
- It ("should be able to set a LabelSelector" , func () {
2064
- lo := & client.ListOptions {}
2065
- err := lo .SetLabelSelector ("foo=bar" )
2066
- Expect (err ).NotTo (HaveOccurred ())
2067
- Expect (lo .LabelSelector .String ()).To (Equal ("foo=bar" ))
2068
- })
2069
-
2070
- It ("should be able to set a FieldSelector" , func () {
2071
- lo := & client.ListOptions {}
2072
- err := lo .SetFieldSelector ("field1=bar" )
2073
- Expect (err ).NotTo (HaveOccurred ())
2074
- Expect (lo .FieldSelector .String ()).To (Equal ("field1=bar" ))
2075
- })
2076
-
2077
- It ("should be converted to metav1.ListOptions" , func () {
2078
- lo := & client.ListOptions {}
2079
- labels := map [string ]string {"foo" : "bar" }
2080
- mlo := lo .MatchingLabels (labels ).
2081
- MatchingField ("field1" , "bar" ).
2082
- InNamespace ("test-namespace" ).
2083
- AsListOptions ()
2063
+ It ("should be convertable to metav1.ListOptions" , func () {
2064
+ lo := (& client.ListOptions {}).ApplyOptions ([]client.ListOption {
2065
+ client .MatchingField ("field1" , "bar" ),
2066
+ client .InNamespace ("test-namespace" ),
2067
+ client.MatchingLabels {"foo" : "bar" },
2068
+ })
2069
+ mlo := lo .AsListOptions ()
2084
2070
Expect (mlo ).NotTo (BeNil ())
2085
2071
Expect (mlo .LabelSelector ).To (Equal ("foo=bar" ))
2086
2072
Expect (mlo .FieldSelector ).To (Equal ("field1=bar" ))
2087
2073
})
2088
2074
2089
- It ("should be able to set MatchingLabels" , func () {
2090
- lo := & client.ListOptions {}
2091
- Expect (lo .LabelSelector ).To (BeNil ())
2092
- labels := map [string ]string {"foo" : "bar" }
2093
- lo = lo .MatchingLabels (labels )
2094
- Expect (lo .LabelSelector .String ()).To (Equal ("foo=bar" ))
2095
- })
2096
-
2097
- It ("should be able to set MatchingField" , func () {
2098
- lo := & client.ListOptions {}
2099
- Expect (lo .FieldSelector ).To (BeNil ())
2100
- lo = lo .MatchingField ("field1" , "bar" )
2101
- Expect (lo .FieldSelector .String ()).To (Equal ("field1=bar" ))
2102
- })
2103
-
2104
- It ("should be able to set InNamespace" , func () {
2105
- lo := & client.ListOptions {}
2106
- lo = lo .InNamespace ("test-namespace" )
2107
- Expect (lo .Namespace ).To (Equal ("test-namespace" ))
2108
- })
2109
-
2110
- It ("should be created from MatchingLabels" , func () {
2111
- labels := map [string ]string {"foo" : "bar" }
2075
+ It ("should be populated by MatchingLabels" , func () {
2112
2076
lo := & client.ListOptions {}
2113
- client .MatchingLabels ( labels ) (lo )
2077
+ client.MatchingLabels { "foo" : "bar" }. ApplyToList (lo )
2114
2078
Expect (lo ).NotTo (BeNil ())
2115
2079
Expect (lo .LabelSelector .String ()).To (Equal ("foo=bar" ))
2116
2080
})
2117
2081
2118
- It ("should be created from MatchingField" , func () {
2082
+ It ("should be populated by MatchingField" , func () {
2119
2083
lo := & client.ListOptions {}
2120
- client .MatchingField ("field1" , "bar" )(lo )
2084
+ client .MatchingField ("field1" , "bar" ). ApplyToList (lo )
2121
2085
Expect (lo ).NotTo (BeNil ())
2122
2086
Expect (lo .FieldSelector .String ()).To (Equal ("field1=bar" ))
2123
2087
})
2124
2088
2125
- It ("should be created from InNamespace" , func () {
2126
- lo := & client.ListOptions {}
2127
- client .InNamespace ("test" )(lo )
2128
- Expect (lo ).NotTo (BeNil ())
2129
- Expect (lo .Namespace ).To (Equal ("test" ))
2130
- })
2131
-
2132
- It ("should allow pre-built ListOptions" , func () {
2089
+ It ("should be populated by InNamespace" , func () {
2133
2090
lo := & client.ListOptions {}
2134
- newLo := & client.ListOptions {}
2135
- client .UseListOptions (newLo .InNamespace ("test" ))(lo )
2091
+ client .InNamespace ("test" ).ApplyToList (lo )
2136
2092
Expect (lo ).NotTo (BeNil ())
2137
2093
Expect (lo .Namespace ).To (Equal ("test" ))
2138
2094
})
@@ -2141,7 +2097,7 @@ var _ = Describe("Client", func() {
2141
2097
Describe ("UpdateOptions" , func () {
2142
2098
It ("should allow setting DryRun to 'all'" , func () {
2143
2099
uo := & client.UpdateOptions {}
2144
- client .UpdateDryRunAll (uo )
2100
+ client .DryRunAll . ApplyToUpdate (uo )
2145
2101
all := []string {metav1 .DryRunAll }
2146
2102
Expect (uo .AsUpdateOptions ().DryRun ).To (Equal (all ))
2147
2103
})
@@ -2157,22 +2113,22 @@ var _ = Describe("Client", func() {
2157
2113
Describe ("PatchOptions" , func () {
2158
2114
It ("should allow setting DryRun to 'all'" , func () {
2159
2115
po := & client.PatchOptions {}
2160
- client .PatchDryRunAll (po )
2116
+ client .DryRunAll . ApplyToPatch (po )
2161
2117
all := []string {metav1 .DryRunAll }
2162
2118
Expect (po .AsPatchOptions ().DryRun ).To (Equal (all ))
2163
2119
})
2164
2120
2165
2121
It ("should allow setting Force to 'true'" , func () {
2166
2122
po := & client.PatchOptions {}
2167
- client .ForceOwnership (po )
2123
+ client .ForceOwnership . ApplyToPatch (po )
2168
2124
mpo := po .AsPatchOptions ()
2169
2125
Expect (mpo .Force ).NotTo (BeNil ())
2170
2126
Expect (* mpo .Force ).To (BeTrue ())
2171
2127
})
2172
2128
2173
2129
It ("should allow setting the field manager" , func () {
2174
2130
po := & client.PatchOptions {}
2175
- client .FieldOwner ("some-owner" )(po )
2131
+ client .FieldOwner ("some-owner" ). ApplyToPatch (po )
2176
2132
Expect (po .AsPatchOptions ().FieldManager ).To (Equal ("some-owner" ))
2177
2133
})
2178
2134
@@ -2320,7 +2276,7 @@ func (f *fakeReader) Get(ctx context.Context, key client.ObjectKey, obj runtime.
2320
2276
return nil
2321
2277
}
2322
2278
2323
- func (f * fakeReader ) List (ctx context.Context , list runtime.Object , opts ... client.ListOptionFunc ) error {
2279
+ func (f * fakeReader ) List (ctx context.Context , list runtime.Object , opts ... client.ListOption ) error {
2324
2280
f .Called = f .Called + 1
2325
2281
return nil
2326
2282
}
0 commit comments