add ubuntu to test matrix for local ai and test fixes
This commit is contained in:
@@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [debian, arch, fedora]
|
os: [debian, arch, fedora, ubuntu]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ It installs:
|
|||||||
| Workflow | Trigger |
|
| Workflow | Trigger |
|
||||||
|---|---|
|
|---|---|
|
||||||
| **Unit Tests** — `go test -v ./...` + `go vet ./...` | Pull requests to `main` / `dev` |
|
| **Unit Tests** — `go test -v ./...` + `go vet ./...` | Pull requests to `main` / `dev` |
|
||||||
| **Integration Tests** — full run on Debian, Arch, Fedora (Dagger) and macOS (native) | Push + pull requests to `main` / `dev` |
|
| **Integration Tests** — full run on Debian, Arch, Fedora, Ubuntu (Dagger) and macOS (native) | Push + pull requests to `main` / `dev` |
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
osFlag := flag.String("os", "all", "OS to test (debian, arch, fedora, or all)")
|
osFlag := flag.String("os", "all", "OS to test (debian, arch, fedora, ubuntu, or all)")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var (
|
|||||||
isMacOS bool
|
isMacOS bool
|
||||||
isRHELFamily bool
|
isRHELFamily bool
|
||||||
isArchFamily bool
|
isArchFamily bool
|
||||||
|
isTesting bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -458,7 +457,6 @@ func installOllama() {
|
|||||||
// Pull Gemma 4 E4B and Qwen2.5-Coder 7B
|
// Pull Gemma 4 E4B and Qwen2.5-Coder 7B
|
||||||
fmt.Println(" Pulling Gemma 4 E4B and Qwen2.5-Coder 7B models ...")
|
fmt.Println(" Pulling Gemma 4 E4B and Qwen2.5-Coder 7B models ...")
|
||||||
|
|
||||||
isTesting := flag.Lookup("test.v") != nil || os.Getenv("GO_ENV") == "test"
|
|
||||||
serverRunning := false
|
serverRunning := false
|
||||||
|
|
||||||
// Check if Ollama server is already responding
|
// Check if Ollama server is already responding
|
||||||
|
|||||||
@@ -594,3 +594,69 @@ func TestInstallLocalAISpecialPkgs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIsSpecialPkgInstalledLocalAI(t *testing.T) {
|
||||||
|
defer resetMocks()
|
||||||
|
|
||||||
|
isMacOS = false
|
||||||
|
|
||||||
|
// Test case 1: None of the commands/files exist
|
||||||
|
hasCmd = func(name string) bool { return false }
|
||||||
|
osStat = func(name string) (os.FileInfo, error) { return nil, os.ErrNotExist }
|
||||||
|
|
||||||
|
pkgs := []string{"nvidia-drivers", "cuda-toolkit", "nvidia-container-toolkit", "ollama", "huggingface-cli"}
|
||||||
|
for _, p := range pkgs {
|
||||||
|
if isSpecialPkgInstalled(p) {
|
||||||
|
t.Errorf("expected %s to be not installed", p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test case 2: Check nvidia-drivers
|
||||||
|
hasCmd = func(name string) bool { return name == "nvidia-smi" }
|
||||||
|
if !isSpecialPkgInstalled("nvidia-drivers") {
|
||||||
|
t.Error("expected nvidia-drivers to be installed when nvidia-smi exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test case 3: Check cuda-toolkit via hasCmd
|
||||||
|
hasCmd = func(name string) bool { return name == "nvcc" }
|
||||||
|
if !isSpecialPkgInstalled("cuda-toolkit") {
|
||||||
|
t.Error("expected cuda-toolkit to be installed when nvcc command exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test case 4: Check cuda-toolkit via path existence
|
||||||
|
hasCmd = func(name string) bool { return false }
|
||||||
|
osStat = func(name string) (os.FileInfo, error) {
|
||||||
|
if name == "/usr/local/cuda/bin/nvcc" {
|
||||||
|
return nil, nil // exists
|
||||||
|
}
|
||||||
|
return nil, os.ErrNotExist
|
||||||
|
}
|
||||||
|
if !isSpecialPkgInstalled("cuda-toolkit") {
|
||||||
|
t.Error("expected cuda-toolkit to be installed when /usr/local/cuda/bin/nvcc exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test case 5: Check nvidia-container-toolkit
|
||||||
|
resetMocks()
|
||||||
|
isMacOS = false
|
||||||
|
hasCmd = func(name string) bool { return name == "nvidia-ctk" }
|
||||||
|
if !isSpecialPkgInstalled("nvidia-container-toolkit") {
|
||||||
|
t.Error("expected nvidia-container-toolkit to be installed when nvidia-ctk command exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test case 6: Check ollama
|
||||||
|
resetMocks()
|
||||||
|
isMacOS = false
|
||||||
|
hasCmd = func(name string) bool { return name == "ollama" }
|
||||||
|
if !isSpecialPkgInstalled("ollama") {
|
||||||
|
t.Error("expected ollama to be installed when ollama command exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test case 7: Check huggingface-cli
|
||||||
|
resetMocks()
|
||||||
|
isMacOS = false
|
||||||
|
hasCmd = func(name string) bool { return name == "huggingface-cli" }
|
||||||
|
if !isSpecialPkgInstalled("huggingface-cli") {
|
||||||
|
t.Error("expected huggingface-cli to be installed when huggingface-cli command exists")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
ok github.com/JMR-dev/bootstrap_dev_env 20.206s
|
|
||||||
? github.com/JMR-dev/bootstrap_dev_env/ci [no test files]
|
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
// don't want the human-facing "[ERROR] ..." prints polluting CI logs
|
// don't want the human-facing "[ERROR] ..." prints polluting CI logs
|
||||||
// (GitHub Actions auto-annotates "[ERROR]" lines as workflow errors).
|
// (GitHub Actions auto-annotates "[ERROR]" lines as workflow errors).
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
isTesting = true
|
||||||
issueLogWriter = io.Discard
|
issueLogWriter = io.Discard
|
||||||
disableProgressTracking = true
|
disableProgressTracking = true
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
|
|||||||
Reference in New Issue
Block a user