From 476607e1081753418448b99231e61b7f5ee2b4b7 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Thu, 11 Jun 2026 11:27:14 -0500 Subject: [PATCH] add ubuntu to test matrix for local ai and test fixes --- .github/workflows/integration.yml | 2 +- README.md | 2 +- ci/main.go | 2 +- detect.go | 1 + system.go | 2 - system_test.go | 66 +++++++++++++++++++++++++++++++ test_run.log | 2 - testmain_test.go | 1 + 8 files changed, 71 insertions(+), 7 deletions(-) delete mode 100644 test_run.log diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 44f37db..66dc840 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: [debian, arch, fedora] + os: [debian, arch, fedora, ubuntu] fail-fast: false steps: diff --git a/README.md b/README.md index 182b64f..79579b0 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ It installs: | Workflow | Trigger | |---|---| | **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 diff --git a/ci/main.go b/ci/main.go index 13e74e0..c76f3d5 100644 --- a/ci/main.go +++ b/ci/main.go @@ -12,7 +12,7 @@ import ( ) 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() ctx := context.Background() diff --git a/detect.go b/detect.go index e13f677..9a3cb8c 100644 --- a/detect.go +++ b/detect.go @@ -19,6 +19,7 @@ var ( isMacOS bool isRHELFamily bool isArchFamily bool + isTesting bool ) func init() { diff --git a/system.go b/system.go index 9fb633d..91aeb7f 100644 --- a/system.go +++ b/system.go @@ -1,7 +1,6 @@ package main import ( - "flag" "fmt" "os" "os/exec" @@ -458,7 +457,6 @@ func installOllama() { // Pull Gemma 4 E4B and Qwen2.5-Coder 7B 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 // Check if Ollama server is already responding diff --git a/system_test.go b/system_test.go index 45fd946..c3d23e3 100644 --- a/system_test.go +++ b/system_test.go @@ -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") + } +} + + diff --git a/test_run.log b/test_run.log deleted file mode 100644 index 5cf964f..0000000 --- a/test_run.log +++ /dev/null @@ -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] diff --git a/testmain_test.go b/testmain_test.go index 879daf3..746e910 100644 --- a/testmain_test.go +++ b/testmain_test.go @@ -11,6 +11,7 @@ import ( // don't want the human-facing "[ERROR] ..." prints polluting CI logs // (GitHub Actions auto-annotates "[ERROR]" lines as workflow errors). func TestMain(m *testing.M) { + isTesting = true issueLogWriter = io.Discard disableProgressTracking = true os.Exit(m.Run())