Verify all clean function added for unit tests
[ric-plt/submgr.git] / pkg / control / ut_ctrl_submgr_test.go
index 8727904..65edd1b 100644 (file)
@@ -21,6 +21,7 @@ package control
 
 import (
        "fmt"
+       "github.com/stretchr/testify/assert"
        "io/ioutil"
        "net/http"
        "strconv"
@@ -285,6 +286,14 @@ func (mc *testingSubmgrControl) wait_msgcounter_change(t *testing.T, orig uint64
        return 0, false
 }
 
+func (mc *testingSubmgrControl) VerifyAllClean(t *testing.T) {
+       // Verify that all resources are freed
+       assert.Equal(t, 0, len(mainCtrl.c.registry.register))
+       assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions))
+       verifyRESTKeyCount(t, 0)
+       verifyE2KeyCount(t, 0)
+}
+
 func (mc *testingSubmgrControl) GetMetrics(t *testing.T) (string, error) {
        req, err := http.NewRequest("GET", "http://localhost:8080/ric/v1/metrics", nil)
        if err != nil {