X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=pkg%2Fcontrol%2Fut_ctrl_submgr_test.go;h=1563a00dd4190c5c24f12a8019a90d143476f45c;hb=316b8d22ae977d8063e6277e5c057279b35a95c2;hp=4e2c471e3ea28260776de1a12dd4497c9a6b0d18;hpb=e5fdcd295671f86f1cbda6e5571c6f2075796af4;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index 4e2c471..1563a00 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -83,15 +83,14 @@ func (mc *testingSubmgrControl) SimulateRestart(t *testing.T) { mainCtrl.c.restDuplicateCtrl.Init() // Read subIds and subscriptions from database - go mainCtrl.c.ReadE2Subscriptions() // This needs to be run in own go routine when called from here <<--- improve this + mainCtrl.c.ReadE2Subscriptions() mc.TestLog(t, "mainCtrl.c.registry.register:") - /* - for subId, subs := range mainCtrl.c.registry.register { - mc.TestLog(t, " subId=%v", subId) - mc.TestLog(t, " subs.SubRespRcvd=%v", subs.SubRespRcvd) - mc.TestLog(t, " subs=%v\n", subs) - } - */ + for subId, subs := range mainCtrl.c.registry.register { + mc.TestLog(t, " subId=%v", subId) + mc.TestLog(t, " subs.SubRespRcvd=%v", subs.SubRespRcvd) + mc.TestLog(t, " subs=%v\n", subs) + } + // Read REST subIds and REST subscriptions from database mainCtrl.c.ReadRESTSubscriptions() mc.TestLog(t, "mainCtrl.c.registry.restSubscriptions:") @@ -99,7 +98,6 @@ func (mc *testingSubmgrControl) SimulateRestart(t *testing.T) { mc.TestLog(t, " restSubId=%v", restSubId) mc.TestLog(t, " restSubs=%v\n", restSubs) } - //go mainCtrl.c.HandleUncompletedSubscriptions(mainCtrl.c.registry.register) // This needs to be run in own go routine when called from here } func (mc *testingSubmgrControl) MakeTransactionNil(t *testing.T, subId uint32) { @@ -123,7 +121,7 @@ func (mc *testingSubmgrControl) removeExistingSubscriptions(t *testing.T) { mainCtrl.c.registry.Initialize() } -func PringSubscriptionQueryResult(resp models.SubscriptionList) { +func PrintSubscriptionQueryResult(resp models.SubscriptionList) { for _, item := range resp { fmt.Printf("item.SubscriptionID=%v\n", item.SubscriptionID) fmt.Printf("item.Meid=%v\n", item.Meid) @@ -297,8 +295,8 @@ func (mc *testingSubmgrControl) VerifyAllClean(t *testing.T) { break } } + xapp.Logger.Debug("VerifyAllClean. Adding 100ms more delay to complete") <-time.After(time.Millisecond * 100) - xapp.Logger.Debug("VerifyAllClean delay plus 100ms") } assert.Equal(t, 0, len(mainCtrl.c.registry.register)) @@ -317,7 +315,17 @@ func (mc *testingSubmgrControl) WaitOngoingRequestMapEmpty() { for i := 0; i < 100; i++ { if len(mainCtrl.c.restDuplicateCtrl.ongoingRequestMap) != 0 { <-time.After(time.Millisecond * 100) - xapp.Logger.Debug("WaitOngoingRequestMapEmpty delay plus 100ms") + xapp.Logger.Debug("WaitOngoingRequestMapEmpty. Adding 100ms more delay to complete") + } + } +} + +func (mc *testingSubmgrControl) WaitRESTSubscriptionDelete(restSubsId string) { + for i := 0; i < 100; i++ { + restSubscription, _ := mainCtrl.c.registry.GetRESTSubscription(restSubsId, false) + if restSubscription != nil { + xapp.Logger.Debug("WaitRESTSubscriptionDelete. Adding 100ms more delay to complete") + <-time.After(time.Millisecond * 100) } } }