call close method when finish profileMap in ut

This commit is contained in:
googs1025 2024-07-23 22:30:17 +08:00
parent 1854839ff0
commit 9eaede70ed

View File

@ -251,6 +251,16 @@ func TestNewMap(t *testing.T) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
m, err := NewMap(ctx, tc.cfgs, fakeRegistry, nilRecorderFactory)
defer func() {
if m != nil {
// to close all frameworks registered in this map.
err := m.Close()
if err != nil {
t.Errorf("error closing map: %v", err)
}
}
}()
if err := checkErr(err, tc.wantErr); err != nil {
t.Fatal(err)
}