Removes more Wild Cloud cruft.

This commit is contained in:
2026-07-11 23:21:23 +00:00
parent ac66ba653d
commit 5d8fe6a754
21 changed files with 196 additions and 1391 deletions

View File

@@ -147,13 +147,4 @@ func SaveState(config *State, configPath string) error {
return os.WriteFile(configPath, data, 0644)
}
// IsEmpty checks if the configuration is empty or uninitialized
func (c *State) IsEmpty() bool {
if c == nil {
return true
}
// Check if essential fields are empty
return c.Cloud.Central.Domain == "" && c.Operator.Email == ""
}

View File

@@ -236,63 +236,6 @@ func TestSaveState_CreatesDirectory(t *testing.T) {
}
}
// Test: State.IsEmpty checks if config is empty
func TestState_IsEmpty(t *testing.T) {
tests := []struct {
name string
config *State
want bool
}{
{
name: "nil config is empty",
config: nil,
want: true,
},
{
name: "default config is empty",
config: &State{},
want: true,
},
{
name: "config with only central domain is not empty",
config: func() *State {
cfg := &State{}
cfg.Cloud.Central.Domain = "central.example.com"
return cfg
}(),
want: false,
},
{
name: "config with only operator email is not empty",
config: func() *State {
cfg := &State{}
cfg.Operator.Email = "admin@example.com"
return cfg
}(),
want: false,
},
{
name: "config with all fields is not empty",
config: func() *State {
cfg := &State{}
cfg.Cloud.Central.Domain = "central.example.com"
cfg.Operator.Email = "admin@example.com"
return cfg
}(),
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := tt.config.IsEmpty()
if got != tt.want {
t.Errorf("IsEmpty() = %v, want %v", got, tt.want)
}
})
}
}
// Test: Round-trip save and load preserves data
func TestState_RoundTrip(t *testing.T) {
tempDir := t.TempDir()