Test and debug interface improvements
[ric-plt/submgr.git] / pkg / control / sdl_restSubsDb_test.go
index 273a15e..5e1db60 100644 (file)
@@ -89,6 +89,7 @@ func CreateRESTSubscription(t *testing.T) *RESTSubscription {
        t.Log("TEST: Creating REST subscription")
 
        restSubscription := &RESTSubscription{}
+       restSubscription.xAppServiceName = "localhost"
        restSubscription.xAppRmrEndPoint = "localhost:13560"
        restSubscription.Meid = "RAN_NAME_1"
        restSubscription.SubReqOngoing = true
@@ -100,6 +101,7 @@ func CreateRESTSubscription(t *testing.T) *RESTSubscription {
 
 func PrintRESTSubscriptionData(t *testing.T, restSubs *RESTSubscription) {
        t.Log("TEST: RESTSubscription data")
+       t.Logf("TEST: restSubs.xAppServiceName = %v", restSubs.xAppServiceName)
        t.Logf("TEST: restSubs.xAppRmrEndPoint = %v", restSubs.xAppRmrEndPoint)
        t.Logf("TEST: restSubs.Meid = %v", restSubs.Meid)
        t.Logf("TEST: restSubs.InstanceIds = %v", restSubs.InstanceIds)
@@ -120,6 +122,17 @@ func TestWriteRESTSubscriptionToSdl(t *testing.T) {
                t.Errorf("TEST: %s", err.Error())
        }
        restSubsDbMock.AddRestSubIdsInDb(restSubId)
+       verifyRESTKeyCount(t, 1)
+}
+
+func verifyRESTKeyCount(t *testing.T, expectedCount int) {
+
+       count, err := mainCtrl.c.GetRESTKeyCount()
+       if err != nil {
+               t.Errorf("TEST: %s", err.Error())
+       } else {
+               assert.Equal(t, expectedCount, count)
+       }
 }
 
 func TestReadRESTSubscriptionFromSdl(t *testing.T) {