X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_ctrl_submgr_test.go;h=16da422f8fec8b777a8738b263548fe8541cf4f7;hb=83ada00338d2c9fa47d48c406b4a46b9d7888aff;hp=197eb43feb1356ae2943d502543f67041832c9ae;hpb=fa0156680b0bd8f7300f49c65d2ee7bedaaa0e44;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index 197eb43..16da422 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -43,11 +43,25 @@ func createSubmgrControl(desc string, rtfile string, port string) *testingSubmgr return mainCtrl } -func (mc *testingSubmgrControl) wait_subs_clean(t *testing.T, e2SubsId int, secs int) bool { +func (mc *testingSubmgrControl) wait_registry_empty(t *testing.T, secs int) bool { + cnt := int(0) + i := 1 + for ; i <= secs*2; i++ { + cnt = len(mc.c.registry.register) + if cnt == 0 { + return true + } + time.Sleep(500 * time.Millisecond) + } + testError(t, "(general) no registry empty within %d secs: %d", secs, cnt) + return false +} + +func (mc *testingSubmgrControl) wait_subs_clean(t *testing.T, e2SubsId uint32, secs int) bool { var subs *Subscription i := 1 for ; i <= secs*2; i++ { - subs = mc.c.registry.GetSubscription(uint16(e2SubsId)) + subs = mc.c.registry.GetSubscription(e2SubsId) if subs == nil { return true } @@ -61,11 +75,11 @@ func (mc *testingSubmgrControl) wait_subs_clean(t *testing.T, e2SubsId int, secs return false } -func (mc *testingSubmgrControl) wait_subs_trans_clean(t *testing.T, e2SubsId int, secs int) bool { - var trans *Transaction +func (mc *testingSubmgrControl) wait_subs_trans_clean(t *testing.T, e2SubsId uint32, secs int) bool { + var trans TransactionIf i := 1 for ; i <= secs*2; i++ { - subs := mc.c.registry.GetSubscription(uint16(e2SubsId)) + subs := mc.c.registry.GetSubscription(e2SubsId) if subs == nil { return true } @@ -83,13 +97,13 @@ func (mc *testingSubmgrControl) wait_subs_trans_clean(t *testing.T, e2SubsId int return false } -func (mc *testingSubmgrControl) get_subid(t *testing.T) uint16 { +func (mc *testingSubmgrControl) get_subid(t *testing.T) uint32 { mc.c.registry.mutex.Lock() defer mc.c.registry.mutex.Unlock() return mc.c.registry.subIds[0] } -func (mc *testingSubmgrControl) wait_subid_change(t *testing.T, origSubId uint16, secs int) (uint16, bool) { +func (mc *testingSubmgrControl) wait_subid_change(t *testing.T, origSubId uint32, secs int) (uint32, bool) { i := 1 for ; i <= secs*2; i++ { mc.c.registry.mutex.Lock()