X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=pkg%2Fcontrol%2Fmain_test.go;h=ab0bff66c7237df176151f9c27850b8df2256059;hb=refs%2Fchanges%2F86%2F2286%2F4;hp=d3d7b57acfcaccf24a315908ba784373398ebec7;hpb=a93ec3c226130e8a300b107cd582dc57004e0c40;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/main_test.go b/pkg/control/main_test.go index d3d7b57..ab0bff6 100644 --- a/pkg/control/main_test.go +++ b/pkg/control/main_test.go @@ -174,6 +174,27 @@ type testingRmrStubControl struct { testingRmrControl rmrClientTest *xapp.RMRClient active bool + msgCnt uint64 +} + +func (tc *testingRmrStubControl) GetMsgCnt() uint64 { + return tc.msgCnt +} + +func (tc *testingRmrStubControl) IncMsgCnt() { + tc.msgCnt++ +} + +func (tc *testingRmrStubControl) DecMsgCnt() { + if tc.msgCnt > 0 { + tc.msgCnt-- + } +} + +func (tc *testingRmrStubControl) TestMsgCnt(t *testing.T) { + if tc.GetMsgCnt() > 0 { + testError(t, "(%s) message count expected 0 but is %d", tc.desc, tc.GetMsgCnt()) + } } func (tc *testingRmrStubControl) RmrSend(params *RMRParams) (err error) { @@ -268,6 +289,7 @@ func (tc *testingXappControl) Consume(params *xapp.RMRParams) (err error) { if strings.Contains(msg.Xid, tc.desc) { xapp.Logger.Info("(%s) Consume %s", tc.desc, msg.String()) + tc.IncMsgCnt() tc.rmrConChan <- msg } else { xapp.Logger.Info("(%s) Ignore %s", tc.desc, msg.String())