This repository has been archived on 2026-11-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
node-lookup/cmd/pburl/main_test.go
T

24 lines
578 B
Go

package main
import (
"path/filepath"
"strings"
"testing"
"node-lookup/internal/puppet"
)
func TestExecute_MissingPuppetboardURL(t *testing.T) {
dir := t.TempDir()
t.Setenv("XDG_CONFIG_HOME", dir)
t.Setenv("NODE_LOOKUP_PUPPETBOARD_URL", "")
old := puppet.SystemConfigPath
puppet.SystemConfigPath = filepath.Join(dir, "etc-config.yaml")
t.Cleanup(func() { puppet.SystemConfigPath = old })
err := execute([]string{"host1"})
if err == nil || !strings.Contains(err.Error(), "puppetboard_url") {
t.Fatalf("expected missing puppetboard_url error, got %v", err)
}
}