@@ -42,7 +42,6 @@ const (
42
42
)
43
43
44
44
var (
45
- cfg * rest.Config
46
45
k8sClient k8sclient.Client
47
46
testEnv * envtest.Environment
48
47
scheme = runtime .NewScheme ()
@@ -173,7 +172,6 @@ func TestKubeInferenceModelRequest(t *testing.T) {
173
172
wantBody []byte
174
173
wantErr bool
175
174
}{
176
- //TODO
177
175
{
178
176
name : "success" ,
179
177
req : GenerateRequest ("sql-lora" ),
@@ -198,8 +196,6 @@ func TestKubeInferenceModelRequest(t *testing.T) {
198
196
},
199
197
}
200
198
201
- log .Print ("==== Start of TestKubeInferenceModelRequest" ) // logging
202
-
203
199
// Set up mock k8s API Client
204
200
testEnv = & envtest.Environment {
205
201
CRDDirectoryPaths : []string {filepath .Join (".." , ".." , ".." , "config" , "crd" , "bases" )},
@@ -254,9 +250,7 @@ func TestKubeInferenceModelRequest(t *testing.T) {
254
250
},
255
251
},
256
252
}
257
- log .Print ("&&&& Start of Tests &&&&" ) // logging
258
253
for _ , test := range tests {
259
- log .Printf ("==== Start of Test: %+v" , test ) // logging
260
254
t .Run (test .name , func (t * testing.T ) {
261
255
client , cleanup := setUpHermeticServer (t , cfg , pods )
262
256
t .Cleanup (cleanup )
@@ -290,6 +284,7 @@ func TestKubeInferenceModelRequest(t *testing.T) {
290
284
}
291
285
292
286
func setUpServer (t * testing.T , pods []* backend.PodMetrics , models map [string ]* v1alpha1.InferenceModel ) (client extProcPb.ExternalProcessor_ProcessClient , cleanup func ()) {
287
+ t .Logf ("Setting up ExtProc server" )
293
288
server := StartExtProc (port , time .Second , time .Second , pods , models )
294
289
295
290
address := fmt .Sprintf ("localhost:%v" , port )
@@ -312,8 +307,7 @@ func setUpServer(t *testing.T, pods []*backend.PodMetrics, models map[string]*v1
312
307
}
313
308
314
309
func setUpHermeticServer (t * testing.T , cfg * rest.Config , pods []* backend.PodMetrics ) (client extProcPb.ExternalProcessor_ProcessClient , cleanup func ()) {
315
-
316
- t .Logf ("===Setting up hermetic server" )
310
+ t .Logf ("Setting up hermetic ExtProc server" )
317
311
klog .InitFlags (nil )
318
312
flag .Parse ()
319
313
// Configure klog verbosity levels to print ext proc logs.
@@ -343,22 +337,18 @@ func setUpHermeticServer(t *testing.T, cfg *rest.Config, pods []*backend.PodMetr
343
337
344
338
var inferenceModels []* v1alpha1.InferenceModel
345
339
for _ , doc := range docs {
346
- // log.Printf("#### doc (yaml):%s", doc)
347
340
inferenceModel := & v1alpha1.InferenceModel {}
348
341
if err = yaml .Unmarshal (doc , inferenceModel ); err != nil {
349
342
log .Fatalf ("Can't unmarshal object: %v" , doc )
350
343
}
351
- // log.Printf("#### inferenceModel.Kind: %v", inferenceModel.Kind)
352
- // log.Printf("#### object %+v", inferenceModel.Spec)
353
344
if inferenceModel .Kind != "InferenceModel" {
354
345
continue
355
346
}
356
- // log.Print("$$$ ADDED OBJECT AS InferenceModel $$$")
357
347
inferenceModels = append (inferenceModels , inferenceModel )
358
348
}
359
- t .Logf ("=== Inference models to add: %+v" , inferenceModels )
349
+ t .Logf ("Inference models to add: %+v" , inferenceModels )
360
350
for _ , model := range inferenceModels {
361
- t .Logf ("=== Creating inference model: %+v" , model )
351
+ t .Logf ("Creating inference model: %+v" , model )
362
352
if err := k8sClient .Create (context .Background (), model ); err != nil {
363
353
log .Fatalf ("unable to create inferenceModel %v: %v" , model .GetName (), err )
364
354
}
@@ -376,17 +366,9 @@ func setUpHermeticServer(t *testing.T, cfg *rest.Config, pods []*backend.PodMetr
376
366
if err != nil {
377
367
log .Fatalf ("Ext-proc failed with the err: %v" , err )
378
368
}
379
- // t.Logf("#### [Before] datastore inference models: %+v", runner.Datastore.GetInferenceModels()) // logging
380
-
381
- // reflection.Register(server)
382
-
383
- // log.Printf("#### datastore after: %+v", datastore) // logging
384
- // log.Printf("#### datastore inference models: %+v", datastore.InferenceModels) // logging
385
369
386
370
// Wait the reconciler to populate the datastore.
387
371
time .Sleep (10 * time .Second )
388
- // log.Printf("#### [After] datastore inference models: %+v", runner.Datastore.GetInferenceModels()) // logging
389
- //log.Fatalf("STOP")
390
372
391
373
address := fmt .Sprintf ("localhost:%v" , port )
392
374
// Create a grpc connection
@@ -395,8 +377,6 @@ func setUpHermeticServer(t *testing.T, cfg *rest.Config, pods []*backend.PodMetr
395
377
log .Fatalf ("Failed to connect to %v: %v" , address , err )
396
378
}
397
379
398
- // log.Printf("#### connection: %+v", conn) // logging
399
-
400
380
ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
401
381
client , err = extProcPb .NewExternalProcessorClient (conn ).Process (ctx )
402
382
if err != nil {
@@ -441,16 +421,12 @@ func readDocuments(fp string) ([][]byte, error) {
441
421
if errors .Is (err , io .EOF ) {
442
422
break
443
423
}
444
-
445
424
return nil , err
446
425
}
447
-
448
426
docs = append (docs , doc )
449
427
}
450
-
451
428
return docs , nil
452
429
}
453
-
454
430
func pointer (v int32 ) * int32 {
455
431
return & v
456
432
}
0 commit comments