Alerting: Fix notifier tests to close the temp file (#38992)

This commit is contained in:
Yuriy Tseretyan 2021-09-09 09:56:42 -04:00 committed by GitHub
parent 4c921cf120
commit 6c2884ac37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -89,6 +89,9 @@ Labels:
func templateForTests(t *testing.T) *template.Template {
f, err := ioutil.TempFile("/tmp", "template")
require.NoError(t, err)
defer func(f *os.File) {
_ = f.Close()
}(f)
t.Cleanup(func() {
require.NoError(t, os.RemoveAll(f.Name()))

View File

@ -58,6 +58,9 @@ func TestDefaultTemplateString(t *testing.T) {
f, err := ioutil.TempFile("/tmp", "template")
require.NoError(t, err)
defer func(f *os.File) {
_ = f.Close()
}(f)
t.Cleanup(func() {
require.NoError(t, os.RemoveAll(f.Name()))