Verify all clean function taken in use in all unit test cases.
Two merge related test cases commented out as they did not pass
and require code fix.
Change-Id: Ib716f5f62d57227b3c4318f03e55ba671fddc62c
Signed-off-by: Anssi Mannila <anssi.mannila@nokia.com>
diff --git a/pkg/control/control.go b/pkg/control/control.go
index 7de724e..4c09ee2 100755
--- a/pkg/control/control.go
+++ b/pkg/control/control.go
@@ -461,6 +461,7 @@
if duplicate {
err := fmt.Errorf("Retransmission blocker direct ACK for request of restSubsId %s restSubId MD5sum %s as retransmission", restSubId, md5sum)
xapp.Logger.Debug("%s", err)
+ c.registry.DeleteRESTSubscription(&restSubId)
c.UpdateCounter(cRestSubRespToXapp)
return &subResp, common.SubscribeCreatedCode
}
@@ -469,6 +470,7 @@
e2SubscriptionDirectives, err := c.GetE2SubscriptionDirectives(p)
if err != nil {
xapp.Logger.Error("%s", err)
+ c.registry.DeleteRESTSubscription(&restSubId)
return nil, common.SubscribeBadRequestCode
}
go c.processSubscriptionRequests(restSubscription, &subReqList, p.ClientEndpoint, p.Meid, &restSubId, xAppRmrEndpoint, md5sum, e2SubscriptionDirectives)
@@ -520,7 +522,7 @@
clientEndpoint *models.SubscriptionParamsClientEndpoint, meid *string, restSubId *string, xAppRmrEndpoint string, md5sum string, e2SubscriptionDirectives *E2SubscriptionDirectives) {
c.SubscriptionProcessingStartDelay()
- xapp.Logger.Debug("Subscription Request count=%v ", len(subReqList.E2APSubscriptionRequests))
+ xapp.Logger.Debug("E2 SubscriptionRequest count =%v ", len(subReqList.E2APSubscriptionRequests))
var xAppEventInstanceID int64
var e2EventInstanceID int64
@@ -615,18 +617,16 @@
c.RemoveSubscriptionFromDb(subs)
err = fmt.Errorf("E2 interface down")
errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "")
- return nil, &errorInfo, err
}
case *e2ap.E2APSubscriptionFailure:
err = fmt.Errorf("E2 SubscriptionFailure received")
errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "")
- return nil, &errorInfo, err
case *PackSubscriptionRequestErrortEvent:
err = fmt.Errorf("E2 SubscriptionRequest pack failure")
- return nil, &themsg.ErrorInfo, err
+ errorInfo = themsg.ErrorInfo
case *SDLWriteErrortEvent:
err = fmt.Errorf("SDL write failure")
- return nil, &themsg.ErrorInfo, err
+ errorInfo = themsg.ErrorInfo
default:
err = fmt.Errorf("Unexpected E2 subscription response received")
errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "")
@@ -642,7 +642,6 @@
}
xapp.Logger.Error("XAPP-SubReq E2 subscription failed %s", idstring(err, trans, subs))
-
c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c)
return nil, &errorInfo, err
}
@@ -683,6 +682,7 @@
c.UpdateCounter(cRestSubFailNotifToXapp)
xapp.Subscription.Notify(resp, *clientEndpoint)
+ // E2 is down. Delete completely processed request safely now
if c.e2IfState.IsE2ConnectionUp(&restSubscription.Meid) == false && restSubscription.SubReqOngoing == false {
c.registry.DeleteRESTSubscription(restSubId)
c.RemoveRESTSubscriptionFromDb(*restSubId)
@@ -717,6 +717,7 @@
c.UpdateCounter(cRestSubNotifToXapp)
xapp.Subscription.Notify(resp, *clientEndpoint)
+ // E2 is down. Delete completely processed request safely now
if c.e2IfState.IsE2ConnectionUp(&restSubscription.Meid) == false && restSubscription.SubReqOngoing == false {
c.registry.DeleteRESTSubscription(restSubId)
c.RemoveRESTSubscriptionFromDb(*restSubId)
@@ -1116,6 +1117,7 @@
// This simulates that no response has been received and after restart subscriptions are restored from db
xapp.Logger.Debug("Test restart flag is active. Dropping this transaction to test restart case")
case *PackSubscriptionRequestErrortEvent, *SDLWriteErrortEvent:
+ removeSubscriptionFromDb = true
subRfMsg, valid = subs.SetCachedResponse(event, false)
default:
// Timer expiry
@@ -1189,7 +1191,7 @@
subReqMsg.RequestId.Id = ricRequestorId
trans.Mtype, trans.Payload, err = c.e2ap.PackSubscriptionRequest(subReqMsg)
if err != nil {
- xapp.Logger.Error("SUBS-SubReq: %s", idstring(err, trans, subs, parentTrans))
+ xapp.Logger.Error("SUBS-SubReq ASN1 pack error: %s", idstring(err, trans, subs, parentTrans))
return &PackSubscriptionRequestErrortEvent{
ErrorInfo{
ErrorSource: models.SubscriptionInstanceErrorSourceASN1,