@@ -73,6 +73,12 @@ func TestInferencePoolConvertTo(t *testing.T) {
7373						{
7474							GatewayRef : ParentGatewayReference {Name : "my-gateway" },
7575							Conditions : []metav1.Condition {
76+ 								{ // v1alpha2 default condition is skipped from conversion. 
77+ 									Type :               string (v1 .InferencePoolConditionAccepted ),
78+ 									Status :             metav1 .ConditionUnknown ,
79+ 									Reason :             string (InferencePoolReasonPending ),
80+ 									LastTransitionTime : timestamp ,
81+ 								},
7682								{
7783									Type :               string (InferencePoolConditionAccepted ),
7884									Status :             metav1 .ConditionTrue ,
@@ -127,7 +133,7 @@ func TestInferencePoolConvertTo(t *testing.T) {
127133			wantErr : false ,
128134		},
129135		{
130- 			name : "conversion from v1alpha2 to v1 with empty extensionRef and nil  status condition" ,
136+ 			name : "conversion from v1alpha2 to v1 with empty extensionRef and default v1alpha2  status condition" ,
131137			src : & InferencePool {
132138				TypeMeta : metav1.TypeMeta {
133139					Kind :       "InferencePool" ,
@@ -147,6 +153,14 @@ func TestInferencePoolConvertTo(t *testing.T) {
147153					Parents : []PoolStatus {
148154						{
149155							GatewayRef : ParentGatewayReference {Name : "my-gateway" },
156+ 							Conditions : []metav1.Condition {
157+ 								{
158+ 									Type :               string (v1 .InferencePoolConditionAccepted ),
159+ 									Status :             metav1 .ConditionUnknown ,
160+ 									Reason :             string (InferencePoolReasonPending ),
161+ 									LastTransitionTime : timestamp ,
162+ 								},
163+ 							},
150164						},
151165					},
152166				},
@@ -178,60 +192,6 @@ func TestInferencePoolConvertTo(t *testing.T) {
178192			},
179193			wantErr : false ,
180194		},
181- 		{
182- 			name : "conversion from v1alpha2 to v1 with empty extensionRef and empty status condition" ,
183- 			src : & InferencePool {
184- 				TypeMeta : metav1.TypeMeta {
185- 					Kind :       "InferencePool" ,
186- 					APIVersion : GroupVersion .String (),
187- 				},
188- 				ObjectMeta : metav1.ObjectMeta {
189- 					Name :      "test-pool" ,
190- 					Namespace : "test-ns" ,
191- 				},
192- 				Spec : InferencePoolSpec {
193- 					Selector : map [LabelKey ]LabelValue {
194- 						"app" : "my-model-server" ,
195- 					},
196- 					TargetPortNumber : 8080 ,
197- 				},
198- 				Status : InferencePoolStatus {
199- 					Parents : []PoolStatus {
200- 						{
201- 							GatewayRef : ParentGatewayReference {Name : "my-gateway" },
202- 							Conditions : []metav1.Condition {},
203- 						},
204- 					},
205- 				},
206- 			},
207- 			want : & v1.InferencePool {
208- 				TypeMeta : metav1.TypeMeta {
209- 					Kind :       "InferencePool" ,
210- 					APIVersion : v1 .GroupVersion .String (),
211- 				},
212- 				ObjectMeta : metav1.ObjectMeta {
213- 					Name :      "test-pool" ,
214- 					Namespace : "test-ns" ,
215- 				},
216- 				Spec : v1.InferencePoolSpec {
217- 					Selector : v1.LabelSelector {
218- 						MatchLabels : map [v1.LabelKey ]v1.LabelValue {
219- 							"app" : "my-model-server" ,
220- 						},
221- 					},
222- 					TargetPorts : []v1.Port {{Number : v1 .PortNumber (int32 (8080 ))}},
223- 				},
224- 				Status : v1.InferencePoolStatus {
225- 					Parents : []v1.ParentStatus {
226- 						{
227- 							ParentRef :  v1.ParentReference {Name : "my-gateway" },
228- 							Conditions : []metav1.Condition {},
229- 						},
230- 					},
231- 				},
232- 			},
233- 			wantErr : false ,
234- 		},
235195	}
236196
237197	for  _ , tt  :=  range  tests  {
0 commit comments