fix: use absolute path for nixos-version executable
Use /run/current-system/sw/bin/nixos-version instead of relying on PATH, since the systemd service may not have the system binaries in its PATH. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,14 +2,14 @@ package collector
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os/exec"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetNixosVersionInfo(t *testing.T) {
|
||||
// Skip if nixos-version command is not available
|
||||
if _, err := exec.LookPath("nixos-version"); err != nil {
|
||||
t.Skip("nixos-version command not available")
|
||||
if _, err := os.Stat(nixosVersionPath); os.IsNotExist(err) {
|
||||
t.Skip("nixos-version command not available (not running on NixOS)")
|
||||
}
|
||||
|
||||
info, err := getNixosVersionInfo()
|
||||
|
||||
Reference in New Issue
Block a user