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:
Ettore Di Giacinto
2026-05-11 13:25:11 +00:00
parent b9e81dbfd4
commit cbcf514880

View File

@@ -194,7 +194,14 @@ var _ = Describe("Backend container", Ordered, func() {
BeforeAll(func() { BeforeAll(func() {
image := os.Getenv("BACKEND_IMAGE") 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") modelURL := os.Getenv("BACKEND_TEST_MODEL_URL")
modelFile = os.Getenv("BACKEND_TEST_MODEL_FILE") modelFile = os.Getenv("BACKEND_TEST_MODEL_FILE")
@@ -223,10 +230,13 @@ var _ = Describe("Backend container", Ordered, func() {
workDir, err = os.MkdirTemp("", "backend-e2e-*") workDir, err = os.MkdirTemp("", "backend-e2e-*")
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
// Extract the image filesystem so we can run run.sh directly. if image != "" {
binaryDir = filepath.Join(workDir, "rootfs") binaryDir = filepath.Join(workDir, "rootfs")
Expect(os.MkdirAll(binaryDir, 0o755)).To(Succeed()) Expect(os.MkdirAll(binaryDir, 0o755)).To(Succeed())
extractImage(image, binaryDir) extractImage(image, binaryDir)
} else {
binaryDir = filepath.Dir(binary)
}
Expect(filepath.Join(binaryDir, "run.sh")).To(BeAnExistingFile()) Expect(filepath.Join(binaryDir, "run.sh")).To(BeAnExistingFile())
// Download the model once if not provided and no HF name given. // Download the model once if not provided and no HF name given.