Implement Monlet MVP stack and UI updates
This commit is contained in:
@@ -1,33 +1,17 @@
|
||||
package ids
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
func TestConfiguredWins(t *testing.T) {
|
||||
id, err := LoadOrCreateAgentID(t.TempDir(), "fixed")
|
||||
id, err := ResolveAgentID("fixed", "host")
|
||||
if err != nil || id != "fixed" {
|
||||
t.Fatalf("got %q %v", id, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateAndReuse(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
id1, err := LoadOrCreateAgentID(dir, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
id2, err := LoadOrCreateAgentID(dir, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if id1 != id2 {
|
||||
t.Fatalf("not stable: %q vs %q", id1, id2)
|
||||
}
|
||||
b, _ := os.ReadFile(filepath.Join(dir, "agent_id"))
|
||||
if len(b) == 0 {
|
||||
t.Fatal("agent_id not persisted")
|
||||
func TestHostnameFallback(t *testing.T) {
|
||||
id, err := ResolveAgentID("", "host-1")
|
||||
if err != nil || id != "host-1" {
|
||||
t.Fatalf("got %q %v", id, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user