@@ -177,6 +177,28 @@ var _ = Describe("cache.inheritFrom", func() {
177
177
Expect (selector .Field .Matches (fields.Set {"metadata.name" : "other" , "metadata.namespace" : "inherited" })).To (BeFalse ())
178
178
Expect (selector .Field .Matches (fields.Set {"metadata.name" : "specified" , "metadata.namespace" : "inherited" })).To (BeTrue ())
179
179
})
180
+ It ("uses inherited scheme for inherited selectors" , func () {
181
+ inherited .Scheme = coreScheme
182
+ inherited .SelectorsByObject = map [client.Object ]ObjectSelector {& corev1.ConfigMap {}: {}}
183
+ Expect (checkError (specified .inheritFrom (inherited )).SelectorsByObject ).To (HaveLen (1 ))
184
+ })
185
+ It ("does not use specified scheme for inherited selectors" , func () {
186
+ inherited .Scheme = runtime .NewScheme ()
187
+ specified .Scheme = coreScheme
188
+ inherited .SelectorsByObject = map [client.Object ]ObjectSelector {& corev1.ConfigMap {}: {}}
189
+ _ , err := specified .inheritFrom (inherited )
190
+ Expect (err ).To (WithTransform (runtime .IsNotRegisteredError , BeTrue ()))
191
+ })
192
+ It ("uses inherited scheme for specified selectors" , func () {
193
+ inherited .Scheme = coreScheme
194
+ specified .SelectorsByObject = map [client.Object ]ObjectSelector {& corev1.ConfigMap {}: {}}
195
+ Expect (checkError (specified .inheritFrom (inherited )).SelectorsByObject ).To (HaveLen (1 ))
196
+ })
197
+ It ("uses specified scheme for specified selectors" , func () {
198
+ specified .Scheme = coreScheme
199
+ specified .SelectorsByObject = map [client.Object ]ObjectSelector {& corev1.ConfigMap {}: {}}
200
+ Expect (checkError (specified .inheritFrom (inherited )).SelectorsByObject ).To (HaveLen (1 ))
201
+ })
180
202
})
181
203
Context ("DefaultSelector" , func () {
182
204
It ("is unchanged when specified and inherited are unset" , func () {
0 commit comments