@@ -13,13 +13,14 @@ import (
13
13
"sigs.k8s.io/controller-runtime/pkg/client"
14
14
)
15
15
16
- // TestModelProfiles tests that profiles are applied as expected .
16
+ // Test that patch can apply the priorityClassName to the model pod .
17
17
func TestJSONPatch (t * testing.T ) {
18
+ const expectedPriorityClassName = "test-patch-priority-class"
18
19
sysCfg := baseSysCfg (t )
19
20
initTest (t , sysCfg )
20
21
priorityClass := & schedulingv1.PriorityClass {
21
22
ObjectMeta : metav1.ObjectMeta {
22
- Name : "test-priority-class" ,
23
+ Name : expectedPriorityClassName ,
23
24
},
24
25
}
25
26
require .NoError (t , testK8sClient .Create (testCtx , priorityClass ))
@@ -28,7 +29,6 @@ func TestJSONPatch(t *testing.T) {
28
29
m := modelForTest (t )
29
30
// Make sure there is a Pod created to run assertions against.
30
31
m .Spec .MinReplicas = 1
31
- const expectedPriorityClassName = "test-priority-class"
32
32
m .Spec .JSONPatches = []v1.JSONPatch {
33
33
{
34
34
Op : "add" ,
@@ -53,30 +53,5 @@ func TestJSONPatch(t *testing.T) {
53
53
// Verify the priorityClassName is set on the pod
54
54
assert .Equal (t , expectedPriorityClassName , pod .Spec .PriorityClassName )
55
55
56
- }, 5 * time .Second , time .Second / 10 , "Resource profile and ModelServerPods settings should be applied to the model Pod object" )
57
-
58
- const userImage = "my-repo.com/my-repo/my-image:latest"
59
- require .EventuallyWithT (t , func (t * assert.CollectT ) {
60
- if ! assert .NoError (t , testK8sClient .Get (testCtx , client .ObjectKeyFromObject (m ), m )) {
61
- return
62
- }
63
- m .Spec .Image = userImage
64
- require .NoError (t , testK8sClient .Update (testCtx , m ))
65
- }, 2 * time .Second , time .Second / 10 , "Update model with user specified image" )
66
-
67
- require .NoError (t , testK8sClient .Delete (testCtx , pod ))
68
- require .EventuallyWithT (t , func (t * assert.CollectT ) {
69
- podList := & corev1.PodList {}
70
- if ! assert .NoError (t , testK8sClient .List (testCtx , podList , client .InNamespace (testNS ), client.MatchingLabels {"model" : m .Name })) {
71
- return
72
- }
73
- if ! assert .Len (t , podList .Items , 1 ) {
74
- return
75
- }
76
- pod = & podList .Items [0 ]
77
-
78
- // The Pod should have a single container named "server".
79
- container := mustFindPodContainerByName (t , pod , "server" )
80
- assert .Equal (t , userImage , container .Image )
81
- }, 15 * time .Second , time .Second / 10 , "User specified image should be respected" )
56
+ }, 5 * time .Second , time .Second / 10 , "Pod should have the correct priorityClassName" )
82
57
}
0 commit comments