fix: resolve gateway binary path, pass --config flag, and clarify empty model error (#1337)
This commit is contained in:
3 files changed
+58
-6
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -120,3 +121,30 @@ func TestGatewayStatusIncludesStartConditionWhenNotReady(t *testing.T) {
|
||||
t.Fatalf("gateway_start_reason missing or not string: %#v", body["gateway_start_reason"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindPicoclawBinary_EnvOverride(t *testing.T) {
|
||||
// Create a temporary file to act as the mock binary
|
||||
tmpDir := t.TempDir()
|
||||
mockBinary := filepath.Join(tmpDir, "picoclaw-mock")
|
||||
if err := os.WriteFile(mockBinary, []byte("mock"), 0o755); err != nil {
|
||||
t.Fatalf("WriteFile() error = %v", err)
|
||||
}
|
||||
|
||||
t.Setenv("PICOCLAW_BINARY", mockBinary)
|
||||
|
||||
got := findPicoclawBinary()
|
||||
if got != mockBinary {
|
||||
t.Errorf("findPicoclawBinary() = %q, want %q", got, mockBinary)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindPicoclawBinary_EnvOverride_InvalidPath(t *testing.T) {
|
||||
// When PICOCLAW_BINARY points to a non-existent path, fall through to next strategy
|
||||
t.Setenv("PICOCLAW_BINARY", "/nonexistent/picoclaw-binary")
|
||||
|
||||
got := findPicoclawBinary()
|
||||
// Should not return the invalid path; falls back to "picoclaw" or another found path
|
||||
if got == "/nonexistent/picoclaw-binary" {
|
||||
t.Errorf("findPicoclawBinary() returned invalid env path %q, expected fallback", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user