MCPcopy
hub / github.com/vmware-tanzu/sonobuoy / TestLoadConfigSetsUUID

Function TestLoadConfigSetsUUID

pkg/config/loader_test.go:138–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func TestLoadConfigSetsUUID(t *testing.T) {
139 cfg := New()
140
141 if blob, err := json.Marshal(&cfg); err == nil {
142 if err = os.WriteFile("./config.json", blob, 0644); err != nil {
143 t.Fatalf("Failed to write default config.json: %v", err)
144 }
145 defer os.Remove("./config.json")
146 } else {
147 t.Fatalf("Failed to serialize %v", err)
148 }
149
150 loadedCfg, err := LoadConfig()
151 if err != nil {
152 t.Fatal(err)
153 }
154
155 if loadedCfg.UUID == "" {
156 t.Error("loaded config should have a UUID but was empty")
157 }
158}
159
160func TestDefaultResources(t *testing.T) {
161 // Check that giving empty resources results in empty resources

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
LoadConfigFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected