mirror of
https://github.com/mudler/LocalAI.git
synced 2026-05-19 14:17:21 -04:00
test(e2e-backends): allow BACKEND_BINARY for native-built backends
Adds an escape hatch for hardware-gated backends (e.g. ds4) where the model is too large for Docker build context. When BACKEND_BINARY points at a run.sh produced by 'make -C backend/cpp/<name> package', the suite skips docker image extraction and drives the binary directly. Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
@@ -194,7 +194,14 @@ var _ = Describe("Backend container", Ordered, func() {
|
||||
|
||||
BeforeAll(func() {
|
||||
image := os.Getenv("BACKEND_IMAGE")
|
||||
Expect(image).NotTo(BeEmpty(), "BACKEND_IMAGE env var must be set (e.g. local-ai-backend:llama-cpp)")
|
||||
// BACKEND_BINARY is an escape hatch for hardware-gated backends (e.g. ds4)
|
||||
// where building a full Docker image around an 80+ GB model is impractical.
|
||||
// Points at a `run.sh` produced by `make -C backend/cpp/<name> package`.
|
||||
binary := os.Getenv("BACKEND_BINARY")
|
||||
Expect(image != "" || binary != "").To(BeTrue(),
|
||||
"either BACKEND_IMAGE or BACKEND_BINARY env var must be set")
|
||||
Expect(image != "" && binary != "").To(BeFalse(),
|
||||
"BACKEND_IMAGE and BACKEND_BINARY are mutually exclusive")
|
||||
|
||||
modelURL := os.Getenv("BACKEND_TEST_MODEL_URL")
|
||||
modelFile = os.Getenv("BACKEND_TEST_MODEL_FILE")
|
||||
@@ -223,10 +230,13 @@ var _ = Describe("Backend container", Ordered, func() {
|
||||
workDir, err = os.MkdirTemp("", "backend-e2e-*")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
// Extract the image filesystem so we can run run.sh directly.
|
||||
binaryDir = filepath.Join(workDir, "rootfs")
|
||||
Expect(os.MkdirAll(binaryDir, 0o755)).To(Succeed())
|
||||
extractImage(image, binaryDir)
|
||||
if image != "" {
|
||||
binaryDir = filepath.Join(workDir, "rootfs")
|
||||
Expect(os.MkdirAll(binaryDir, 0o755)).To(Succeed())
|
||||
extractImage(image, binaryDir)
|
||||
} else {
|
||||
binaryDir = filepath.Dir(binary)
|
||||
}
|
||||
Expect(filepath.Join(binaryDir, "run.sh")).To(BeAnExistingFile())
|
||||
|
||||
// Download the model once if not provided and no HF name given.
|
||||
|
||||
Reference in New Issue
Block a user