MCPcopy
hub / github.com/nextdns/nextdns / Test_SaveConfig_noOldFile

Function Test_SaveConfig_noOldFile

host/service/config_test.go:299–315  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

297}
298
299func Test_SaveConfig_noOldFile(t *testing.T) {
300 path := t.TempDir() + "/nextdns.conf"
301
302 str := "100MB"
303 c := map[string]ConfigEntry{
304 "cache-size": ConfigValue{Value: &str, Default: "0"},
305 }
306
307 if err := (ConfigFileStorer{File: path}).SaveConfig(c); err != nil {
308 t.Fatal(err)
309 }
310
311 got := readFile(t, path)
312 if !strings.Contains(got, "cache-size 100MB\n") {
313 t.Errorf("expected key written to new file:\n%s", got)
314 }
315}

Callers

nothing calls this directly

Calls 3

readFileFunction · 0.85
SaveConfigMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…