diff --git a/server/etcdmain/config_test.go b/server/etcdmain/config_test.go index 1a15e20c0ae..8c77bce8c10 100644 --- a/server/etcdmain/config_test.go +++ b/server/etcdmain/config_test.go @@ -790,17 +790,9 @@ enable-distributed-tracing: true cfg := newConfig() if tc.yamlConfig != "" { - tmpfile, err := os.CreateTemp("", "etcd-test-*.yaml") - if err != nil { - t.Fatal(err) - } + tmpfile := mustCreateCfgFile(t, []byte(tc.yamlConfig)) defer os.Remove(tmpfile.Name()) - err = os.WriteFile(tmpfile.Name(), []byte(tc.yamlConfig), 0600) - if err != nil { - t.Fatal(err) - } - tc.args = []string{"--config-file=" + tmpfile.Name()} }