@@ -105,10 +105,11 @@ var _ = Describe("Gallery Backends", func() {
105105 Name : "meta-backend" ,
106106 },
107107 CapabilitiesMap : map [string ]string {
108- "nvidia" : "nvidia-backend" ,
109- "amd" : "amd-backend" ,
110- "intel" : "intel-backend" ,
111- "metal" : "metal-backend" ,
108+ "nvidia" : "nvidia-backend" ,
109+ "amd" : "amd-backend" ,
110+ "intel" : "intel-backend" ,
111+ "metal" : "metal-backend" ,
112+ "default" : "default-backend" ,
112113 },
113114 }
114115
@@ -133,7 +134,14 @@ var _ = Describe("Gallery Backends", func() {
133134 URI : testImage ,
134135 }
135136
136- backends := GalleryElements [* GalleryBackend ]{nvidiaBackend , amdBackend , metalBackend }
137+ defaultBackend := & GalleryBackend {
138+ Metadata : Metadata {
139+ Name : "default-backend" ,
140+ },
141+ URI : testImage ,
142+ }
143+
144+ backends := GalleryElements [* GalleryBackend ]{nvidiaBackend , amdBackend , metalBackend , defaultBackend }
137145
138146 if runtime .GOOS == "darwin" && runtime .GOARCH == "arm64" {
139147 metal := & system.SystemState {}
@@ -142,15 +150,26 @@ var _ = Describe("Gallery Backends", func() {
142150
143151 } else {
144152 // Test with NVIDIA system state
145- nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" }
153+ nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" , VRAM : 1000000000000 }
146154 bestBackend := metaBackend .FindBestBackendFromMeta (nvidiaSystemState , backends )
147155 Expect (bestBackend ).To (Equal (nvidiaBackend ))
148156
149157 // Test with AMD system state
150- amdSystemState := & system.SystemState {GPUVendor : "amd" }
158+ amdSystemState := & system.SystemState {GPUVendor : "amd" , VRAM : 1000000000000 }
151159 bestBackend = metaBackend .FindBestBackendFromMeta (amdSystemState , backends )
152160 Expect (bestBackend ).To (Equal (amdBackend ))
153161
162+ // Test with default system state (not enough VRAM)
163+ defaultSystemState := & system.SystemState {GPUVendor : "amd" }
164+ bestBackend = metaBackend .FindBestBackendFromMeta (defaultSystemState , backends )
165+ Expect (bestBackend ).To (Equal (defaultBackend ))
166+
167+ // Test with default system state
168+ defaultSystemState = & system.SystemState {GPUVendor : "default" }
169+ bestBackend = metaBackend .FindBestBackendFromMeta (defaultSystemState , backends )
170+ Expect (bestBackend ).To (Equal (defaultBackend ))
171+
172+ backends = GalleryElements [* GalleryBackend ]{nvidiaBackend , amdBackend , metalBackend }
154173 // Test with unsupported GPU vendor
155174 unsupportedSystemState := & system.SystemState {GPUVendor : "unsupported" }
156175 bestBackend = metaBackend .FindBestBackendFromMeta (unsupportedSystemState , backends )
@@ -201,7 +220,7 @@ var _ = Describe("Gallery Backends", func() {
201220 Expect (err ).NotTo (HaveOccurred ())
202221
203222 // Test with NVIDIA system state
204- nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" }
223+ nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" , VRAM : 1000000000000 }
205224 err = InstallBackendFromGallery ([]config.Gallery {gallery }, nvidiaSystemState , "meta-backend" , tempDir , nil , true )
206225 Expect (err ).NotTo (HaveOccurred ())
207226
@@ -275,7 +294,7 @@ var _ = Describe("Gallery Backends", func() {
275294 Expect (err ).NotTo (HaveOccurred ())
276295
277296 // Test with NVIDIA system state
278- nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" }
297+ nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" , VRAM : 1000000000000 }
279298 err = InstallBackendFromGallery ([]config.Gallery {gallery }, nvidiaSystemState , "meta-backend" , tempDir , nil , true )
280299 Expect (err ).NotTo (HaveOccurred ())
281300
@@ -352,7 +371,7 @@ var _ = Describe("Gallery Backends", func() {
352371 Expect (err ).NotTo (HaveOccurred ())
353372
354373 // Test with NVIDIA system state
355- nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" }
374+ nvidiaSystemState := & system.SystemState {GPUVendor : "nvidia" , VRAM : 1000000000000 }
356375 err = InstallBackendFromGallery ([]config.Gallery {gallery }, nvidiaSystemState , "meta-backend" , tempDir , nil , true )
357376 Expect (err ).NotTo (HaveOccurred ())
358377
0 commit comments