mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
Alerting: Fix notifier tests to close the temp file (#38992)
This commit is contained in:
parent
4c921cf120
commit
6c2884ac37
@ -89,6 +89,9 @@ Labels:
|
|||||||
func templateForTests(t *testing.T) *template.Template {
|
func templateForTests(t *testing.T) *template.Template {
|
||||||
f, err := ioutil.TempFile("/tmp", "template")
|
f, err := ioutil.TempFile("/tmp", "template")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
defer func(f *os.File) {
|
||||||
|
_ = f.Close()
|
||||||
|
}(f)
|
||||||
|
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
require.NoError(t, os.RemoveAll(f.Name()))
|
require.NoError(t, os.RemoveAll(f.Name()))
|
||||||
|
@ -58,6 +58,9 @@ func TestDefaultTemplateString(t *testing.T) {
|
|||||||
|
|
||||||
f, err := ioutil.TempFile("/tmp", "template")
|
f, err := ioutil.TempFile("/tmp", "template")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
defer func(f *os.File) {
|
||||||
|
_ = f.Close()
|
||||||
|
}(f)
|
||||||
|
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
require.NoError(t, os.RemoveAll(f.Name()))
|
require.NoError(t, os.RemoveAll(f.Name()))
|
||||||
|
Loading…
Reference in New Issue
Block a user