@@ -130,6 +130,7 @@ func TestPodSchedulingOverrides(t *testing.T) {
130
130
expectedNodeSelectors map [string ]string
131
131
expectedTolerations []corev1.Toleration
132
132
expectedPriorityClassName string
133
+ annotations map [string ]string
133
134
}{
134
135
{
135
136
title : "no overrides" ,
@@ -238,11 +239,32 @@ func TestPodSchedulingOverrides(t *testing.T) {
238
239
expectedTolerations : overriddenTolerations ,
239
240
expectedPriorityClassName : overriddenPriorityClassName ,
240
241
expectedNodeSelectors : overriddenNodeSelectors ,
242
+ }, {
243
+ title : "priorityClassName annotation takes precedence" ,
244
+ catalogSource : & v1alpha1.CatalogSource {
245
+ ObjectMeta : metav1.ObjectMeta {
246
+ Name : "test" ,
247
+ Namespace : "testns" ,
248
+ },
249
+ Spec : v1alpha1.CatalogSourceSpec {
250
+ SourceType : v1alpha1 .SourceTypeGrpc ,
251
+ Image : "repo/image:tag" ,
252
+ GrpcPodConfig : & v1alpha1.GrpcPodConfig {
253
+ PriorityClassName : & overriddenPriorityClassName ,
254
+ },
255
+ },
256
+ },
257
+ expectedTolerations : nil ,
258
+ annotations : map [string ]string {
259
+ CatalogPriorityClassKey : "some-OTHER-prio-class" ,
260
+ },
261
+ expectedPriorityClassName : "some-OTHER-prio-class" ,
262
+ expectedNodeSelectors : defaultNodeSelectors ,
241
263
},
242
264
}
243
265
244
266
for _ , testCase := range testCases {
245
- pod := Pod (testCase .catalogSource , "hello" , "busybox" , "" , map [string ]string {}, map [ string ] string {} , int32 (0 ), int32 (0 ))
267
+ pod := Pod (testCase .catalogSource , "hello" , "busybox" , "" , map [string ]string {}, testCase . annotations , int32 (0 ), int32 (0 ))
246
268
require .Equal (t , testCase .expectedNodeSelectors , pod .Spec .NodeSelector )
247
269
require .Equal (t , testCase .expectedPriorityClassName , pod .Spec .PriorityClassName )
248
270
require .Equal (t , testCase .expectedTolerations , pod .Spec .Tolerations )
0 commit comments