24 lines
578 B
Go
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)
|
|
}
|
|
}
|