@@ -205,7 +205,7 @@ func TestGetPodGroupMetadataBackwardsCompatibility(t *testing.T) {
205205 podGroups []* v2alpha2.PodGroup
206206 expectedError bool
207207 expectedPodGroupName string
208- expextedPriorityClass * string // defaults to inference
208+ expectedPriorityClass * string // defaults to inference
209209 expectedMinAvailable int32
210210 }
211211
@@ -575,6 +575,76 @@ func TestGetPodGroupMetadataBackwardsCompatibility(t *testing.T) {
575575 expectedMinAvailable : 1 ,
576576 expectedPodGroupName : "pg-pod-podUID" ,
577577 },
578+ {
579+ name : "priority class name set in pod" ,
580+ service : & knative.Service {
581+ ObjectMeta : metav1.ObjectMeta {
582+ Name : serviceName ,
583+ Namespace : namespace ,
584+ },
585+ },
586+ revisions : []* knative.Revision {
587+ {
588+ ObjectMeta : metav1.ObjectMeta {
589+ Name : "revision" ,
590+ Namespace : namespace ,
591+ UID : "revUID" ,
592+ },
593+ },
594+ },
595+ pods : []* v1.Pod {
596+ {
597+ ObjectMeta : metav1.ObjectMeta {
598+ Name : "pod" ,
599+ Namespace : namespace ,
600+ Labels : map [string ]string {
601+ knativeRevisionLabel : "revision" ,
602+ constants .PriorityLabelKey : "very-high" ,
603+ },
604+ },
605+ },
606+ },
607+ expectedError : false ,
608+ expectedPodGroupName : "pg-revision-revUID" ,
609+ expectedMinAvailable : 1 ,
610+ expectedPriorityClass : ptr .To ("very-high" ),
611+ },
612+ {
613+ name : "priority class name set in top owner" ,
614+ service : & knative.Service {
615+ ObjectMeta : metav1.ObjectMeta {
616+ Name : serviceName ,
617+ Namespace : namespace ,
618+ },
619+ },
620+ revisions : []* knative.Revision {
621+ {
622+ ObjectMeta : metav1.ObjectMeta {
623+ Name : "revision" ,
624+ Namespace : namespace ,
625+ UID : "revUID" ,
626+ Labels : map [string ]string {
627+ constants .PriorityLabelKey : "high" ,
628+ },
629+ },
630+ },
631+ },
632+ pods : []* v1.Pod {
633+ {
634+ ObjectMeta : metav1.ObjectMeta {
635+ Name : "pod" ,
636+ Namespace : namespace ,
637+ Labels : map [string ]string {
638+ knativeRevisionLabel : "revision" ,
639+ },
640+ },
641+ },
642+ },
643+ expectedError : false ,
644+ expectedPodGroupName : "pg-revision-revUID" ,
645+ expectedMinAvailable : 1 ,
646+ expectedPriorityClass : ptr .To ("high" ),
647+ },
578648 }
579649
580650 for _ , test := range tests {
@@ -619,8 +689,8 @@ func TestGetPodGroupMetadataBackwardsCompatibility(t *testing.T) {
619689 assert .Nil (t , err , "unexpected error" )
620690 assert .Equal (t , test .expectedPodGroupName , metadata .Name , "unexpected pod group name" )
621691 expectedPriorityClass := constants .InferencePriorityClass
622- if test .expextedPriorityClass != nil {
623- expectedPriorityClass = * test .expextedPriorityClass
692+ if test .expectedPriorityClass != nil {
693+ expectedPriorityClass = * test .expectedPriorityClass
624694 }
625695 assert .Equal (t , expectedPriorityClass , metadata .PriorityClassName , "unexpected priority class" )
626696 assert .Equal (t , test .expectedMinAvailable , metadata .MinAvailable , "unexpected min available" )
0 commit comments