mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-26 09:26:55 -04:00
When LOCALAI_PREFER_DEV_BACKENDS is set, install the -development image as the primary backend URI (keeping the released image reachable as the first fallback), instead of only reaching development as a download fallback when the released image is missing. This lets an operator force backends built from the development branch — e.g. to pick up a fix already on master before a release. Threads PreferDevelopmentBackends through SystemState so InstallBackend can see it, and reuses the same development-URI convention as the existing failure-path fallback (released tag -> branch tag + dev suffix). The unexported developmentURI helper is covered by a Ginkgo spec. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
27 lines
904 B
Go
27 lines
904 B
Go
package gallery
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("developmentURI", func() {
|
|
const latest, master = "latest", "master"
|
|
|
|
It("rewrites a released image to its branch (development) image", func() {
|
|
got, ok := developmentURI("quay.io/go-skynet/local-ai-backends:latest-metal-darwin-arm64-llama-cpp", latest, master)
|
|
Expect(ok).To(BeTrue())
|
|
Expect(got).To(Equal("quay.io/go-skynet/local-ai-backends:master-metal-darwin-arm64-llama-cpp"))
|
|
})
|
|
|
|
It("leaves an image already on the branch tag untouched", func() {
|
|
_, ok := developmentURI("quay.io/go-skynet/local-ai-backends:master-metal-darwin-arm64-llama-cpp", latest, master)
|
|
Expect(ok).To(BeFalse())
|
|
})
|
|
|
|
It("returns ok=false when there is no released tag to swap", func() {
|
|
_, ok := developmentURI("oci://localhost/custom-backend:edge", latest, master)
|
|
Expect(ok).To(BeFalse())
|
|
})
|
|
})
|