From dbc2767b5b8885eb8ad1463cd9bc74075114e4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Fri, 5 Apr 2024 11:38:05 +0200 Subject: [PATCH] fix: closing leveldb for each test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jürgen Eckel --- monitor/mqtt_monitor_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/monitor/mqtt_monitor_test.go b/monitor/mqtt_monitor_test.go index 6162705..c3398de 100644 --- a/monitor/mqtt_monitor_test.go +++ b/monitor/mqtt_monitor_test.go @@ -25,6 +25,8 @@ func TestGMonitorActiveParticipants(t *testing.T) { monitor.LazyLoadMonitorMQTTClient() cfg := config.GetConfig() db, err := leveldb.OpenFile("./activeActors.db", nil) + defer db.Close() + assert.NoError(t, err) mqttMonitor := monitor.NewMqttMonitorService(db, *cfg) err = mqttMonitor.Start() @@ -42,6 +44,7 @@ func TestGMonitorActiveParticipants(t *testing.T) { assert.NoError(t, err) assert.Contains(t, challenger, "plmnt") assert.Contains(t, challengee, "plmnt") + } func TestCleanupRemoval(t *testing.T) { @@ -49,6 +52,7 @@ func TestCleanupRemoval(t *testing.T) { cfg := config.GetConfig() db, err := leveldb.OpenFile("./activeActors.db", nil) + defer db.Close() assert.NoError(t, err) mqttMonitor := monitor.NewMqttMonitorService(db, *cfg) err = mqttMonitor.Start() @@ -74,6 +78,7 @@ func TestCleanupPrecisionTest(t *testing.T) { cfg := config.GetConfig() db, err := leveldb.OpenFile("./activeActors.db", nil) + defer db.Close() assert.NoError(t, err) mqttMonitor := monitor.NewMqttMonitorService(db, *cfg) err = mqttMonitor.Start()