From 316b8d22ae977d8063e6277e5c057279b35a95c2 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Tue, 21 Dec 2021 09:43:59 +0200 Subject: [PATCH] Submgr restart unit test improvement Change-Id: Ic59f8f8640b29fc1bb43f39e519b98128ab691b7 Signed-off-by: Anssi Mannila --- pkg/control/control.go | 2 +- pkg/control/ut_ctrl_submgr_test.go | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 68688e2..de63216 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -202,7 +202,7 @@ func (c *Control) ReadE2Subscriptions() error { } else { c.registry.subIds = subIds c.registry.register = register - c.HandleUncompletedSubscriptions(register) + go c.HandleUncompletedSubscriptions(register) return nil } } diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index dadf42f..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) -- 2.16.6