Skip to content

Commit 433afcc

Browse files
committed
test(gallery): extend importer specs to cover buun-llama-cpp
Two additions that pair with the new backend: - An Import()-side case that asserts preference buun-llama-cpp produces backend: buun-llama-cpp in the emitted YAML (mirrors the existing ik-llama-cpp and turboquant cases). - AdditionalBackends() spec now asserts all three drop-in replacements are advertised, and verifies buun-llama-cpp's Modality/Description alongside the other two. Assisted-by: Claude:Opus-4.7 [Read] [Edit] [Bash]
1 parent 9e4f5d6 commit 433afcc

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

core/gallery/importers/llama-cpp_test.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,23 @@ var _ = Describe("LlamaCPPImporter", func() {
181181
Expect(modelConfig.Files[0].Filename).To(Equal("my-model.gguf"))
182182
})
183183

184+
It("swaps the emitted backend to buun-llama-cpp when preferred", func() {
185+
preferences := json.RawMessage(`{"backend": "buun-llama-cpp"}`)
186+
details := Details{
187+
URI: "https://example.com/my-model.gguf",
188+
Preferences: preferences,
189+
}
190+
191+
modelConfig, err := importer.Import(details)
192+
193+
Expect(err).ToNot(HaveOccurred())
194+
Expect(modelConfig.ConfigFile).To(ContainSubstring("backend: buun-llama-cpp"), fmt.Sprintf("Model config: %+v", modelConfig))
195+
Expect(modelConfig.ConfigFile).NotTo(ContainSubstring("backend: llama-cpp\n"), fmt.Sprintf("Model config: %+v", modelConfig))
196+
Expect(modelConfig.ConfigFile).To(ContainSubstring("model: my-model.gguf"), fmt.Sprintf("Model config: %+v", modelConfig))
197+
Expect(len(modelConfig.Files)).To(Equal(1))
198+
Expect(modelConfig.Files[0].Filename).To(Equal("my-model.gguf"))
199+
})
200+
184201
It("keeps backend: llama-cpp for unknown backend preferences", func() {
185202
// Unknown backend values must not leak into the emitted YAML —
186203
// we only honour the two curated drop-in replacements.
@@ -375,7 +392,7 @@ var _ = Describe("LlamaCPPImporter", func() {
375392
})
376393

377394
Context("AdditionalBackends", func() {
378-
It("advertises ik-llama-cpp and turboquant as drop-in replacements", func() {
395+
It("advertises ik-llama-cpp, turboquant, and buun-llama-cpp as drop-in replacements", func() {
379396
entries := importer.AdditionalBackends()
380397

381398
names := make([]string, 0, len(entries))
@@ -384,7 +401,7 @@ var _ = Describe("LlamaCPPImporter", func() {
384401
names = append(names, e.Name)
385402
byName[e.Name] = e
386403
}
387-
Expect(names).To(ConsistOf("ik-llama-cpp", "turboquant"))
404+
Expect(names).To(ConsistOf("ik-llama-cpp", "turboquant", "buun-llama-cpp"))
388405

389406
ik := byName["ik-llama-cpp"]
390407
Expect(ik.Modality).To(Equal("text"))
@@ -393,6 +410,10 @@ var _ = Describe("LlamaCPPImporter", func() {
393410
tq := byName["turboquant"]
394411
Expect(tq.Modality).To(Equal("text"))
395412
Expect(tq.Description).NotTo(BeEmpty())
413+
414+
bn := byName["buun-llama-cpp"]
415+
Expect(bn.Modality).To(Equal("text"))
416+
Expect(bn.Description).NotTo(BeEmpty())
396417
})
397418
})
398419
})

0 commit comments

Comments
 (0)