@@ -208,13 +208,16 @@ var _ = Describe("Gallery Backends", func() {
208
208
metaBackendPath := filepath .Join (tempDir , "meta-backend" )
209
209
Expect (metaBackendPath ).To (BeADirectory ())
210
210
211
+ metaBackendPath = filepath .Join (tempDir , "meta-backend" , "metadata.json" )
212
+ Expect (metaBackendPath ).To (BeARegularFile ())
213
+
211
214
concreteBackendPath := filepath .Join (tempDir , "nvidia-backend" )
212
215
Expect (concreteBackendPath ).To (BeADirectory ())
213
216
214
217
allBackends , err := ListSystemBackends (tempDir )
215
218
Expect (err ).NotTo (HaveOccurred ())
216
- Expect (allBackends ). To ( HaveKey ( "meta-backend" ))
217
- Expect (allBackends ). To ( HaveKey ( "nvidia-backend" ))
219
+ Expect (allBackends . Exists ( "meta-backend" )). To ( BeTrue ( ))
220
+ Expect (allBackends . Exists ( "nvidia-backend" )). To ( BeTrue ( ))
218
221
219
222
// Delete meta backend by name
220
223
err = DeleteBackendFromSystem (tempDir , "meta-backend" )
@@ -284,9 +287,14 @@ var _ = Describe("Gallery Backends", func() {
284
287
285
288
allBackends , err := ListSystemBackends (tempDir )
286
289
Expect (err ).NotTo (HaveOccurred ())
287
- Expect (allBackends ).To (HaveKey ("meta-backend" ))
288
- Expect (allBackends ).To (HaveKey ("nvidia-backend" ))
289
- Expect (allBackends ["meta-backend" ]).To (BeEmpty ())
290
+ Expect (allBackends .Exists ("meta-backend" )).To (BeTrue ())
291
+ Expect (allBackends .Exists ("nvidia-backend" )).To (BeTrue ())
292
+
293
+ backend , ok := allBackends .Get ("meta-backend" )
294
+ Expect (ok ).To (BeTrue ())
295
+ Expect (backend .Metadata .MetaBackendFor ).To (Equal ("nvidia-backend" ))
296
+ Expect (backend .RunFile ).To (Equal (filepath .Join (tempDir , "nvidia-backend" , "run.sh" )))
297
+ Expect (backend .IsMeta ).To (BeTrue ())
290
298
291
299
// Delete meta backend by name
292
300
err = DeleteBackendFromSystem (tempDir , "meta-backend" )
@@ -356,9 +364,11 @@ var _ = Describe("Gallery Backends", func() {
356
364
357
365
allBackends , err := ListSystemBackends (tempDir )
358
366
Expect (err ).NotTo (HaveOccurred ())
359
- Expect (allBackends ).To (HaveKey ("meta-backend" ))
360
- Expect (allBackends ).To (HaveKey ("nvidia-backend" ))
361
- Expect (allBackends ["meta-backend" ]).To (Equal (filepath .Join (tempDir , "nvidia-backend" , "run.sh" )))
367
+ Expect (allBackends .Exists ("meta-backend" )).To (BeTrue ())
368
+ Expect (allBackends .Exists ("nvidia-backend" )).To (BeTrue ())
369
+ backend , ok := allBackends .Get ("meta-backend" )
370
+ Expect (ok ).To (BeTrue ())
371
+ Expect (backend .RunFile ).To (Equal (filepath .Join (tempDir , "nvidia-backend" , "run.sh" )))
362
372
363
373
// Delete meta backend by name
364
374
err = DeleteBackendFromSystem (tempDir , "meta-backend" )
@@ -402,13 +412,21 @@ var _ = Describe("Gallery Backends", func() {
402
412
Expect (err ).NotTo (HaveOccurred ())
403
413
404
414
// Should include both the meta backend name and concrete backend name
405
- Expect (backends ).To (HaveKey ("meta-backend" ))
406
- Expect (backends ).To (HaveKey ("concrete-backend" ))
415
+ Expect (backends .Exists ("meta-backend" )).To (BeTrue ())
416
+ Expect (backends .Exists ("concrete-backend" )).To (BeTrue ())
417
+
418
+ // meta-backend should point to concrete-backend
419
+ Expect (backends .Exists ("meta-backend" )).To (BeTrue ())
420
+ backend , ok := backends .Get ("meta-backend" )
421
+ Expect (ok ).To (BeTrue ())
422
+ Expect (backend .Metadata .MetaBackendFor ).To (Equal ("concrete-backend" ))
423
+ Expect (backend .RunFile ).To (Equal (filepath .Join (tempDir , "concrete-backend" , "run.sh" )))
424
+ Expect (backend .IsMeta ).To (BeTrue ())
407
425
408
- // meta-backend should be empty
409
- Expect (backends ["meta-backend" ]).To (BeEmpty ())
410
426
// concrete-backend should point to its own run.sh
411
- Expect (backends ["concrete-backend" ]).To (Equal (filepath .Join (tempDir , "concrete-backend" , "run.sh" )))
427
+ backend , ok = backends .Get ("concrete-backend" )
428
+ Expect (ok ).To (BeTrue ())
429
+ Expect (backend .RunFile ).To (Equal (filepath .Join (tempDir , "concrete-backend" , "run.sh" )))
412
430
})
413
431
})
414
432
@@ -457,8 +475,14 @@ var _ = Describe("Gallery Backends", func() {
457
475
// Check that the alias was recognized
458
476
backends , err := ListSystemBackends (tempDir )
459
477
Expect (err ).ToNot (HaveOccurred ())
460
- Expect (backends ).To (HaveKeyWithValue ("test-alias" , filepath .Join (tempDir , "test-backend" , "run.sh" )))
461
- Expect (backends ).To (HaveKeyWithValue ("test-backend" , filepath .Join (tempDir , "test-backend" , "run.sh" )))
478
+ Expect (backends .Exists ("test-alias" )).To (BeTrue ())
479
+ Expect (backends .Exists ("test-backend" )).To (BeTrue ())
480
+ b , ok := backends .Get ("test-alias" )
481
+ Expect (ok ).To (BeTrue ())
482
+ Expect (b .RunFile ).To (Equal (filepath .Join (tempDir , "test-backend" , "run.sh" )))
483
+ b , ok = backends .Get ("test-backend" )
484
+ Expect (ok ).To (BeTrue ())
485
+ Expect (b .RunFile ).To (Equal (filepath .Join (tempDir , "test-backend" , "run.sh" )))
462
486
})
463
487
})
464
488
@@ -497,10 +521,13 @@ var _ = Describe("Gallery Backends", func() {
497
521
498
522
backends , err := ListSystemBackends (tempDir )
499
523
Expect (err ).NotTo (HaveOccurred ())
500
- Expect (backends ).To (HaveLen (len (backendNames )))
524
+ Expect (backends . GetAll () ).To (HaveLen (len (backendNames )))
501
525
502
526
for _ , name := range backendNames {
503
- Expect (backends ).To (HaveKeyWithValue (name , filepath .Join (tempDir , name , "run.sh" )))
527
+ Expect (backends .Exists (name )).To (BeTrue ())
528
+ backend , ok := backends .Get (name )
529
+ Expect (ok ).To (BeTrue ())
530
+ Expect (backend .RunFile ).To (Equal (filepath .Join (tempDir , name , "run.sh" )))
504
531
}
505
532
})
506
533
@@ -528,7 +555,10 @@ var _ = Describe("Gallery Backends", func() {
528
555
529
556
backends , err := ListSystemBackends (tempDir )
530
557
Expect (err ).NotTo (HaveOccurred ())
531
- Expect (backends ).To (HaveKeyWithValue (alias , filepath .Join (tempDir , backendName , "run.sh" )))
558
+ Expect (backends .Exists (alias )).To (BeTrue ())
559
+ backend , ok := backends .Get (alias )
560
+ Expect (ok ).To (BeTrue ())
561
+ Expect (backend .RunFile ).To (Equal (filepath .Join (tempDir , backendName , "run.sh" )))
532
562
})
533
563
534
564
It ("should return error when base path doesn't exist" , func () {
0 commit comments