X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;fp=pkg%2Fcontrol%2Fut_messaging_test.go;h=4117aff56ab087687148940355b3478f98b4c9de;hb=b43c8445740c9a5ac5535a2b065b403c3608b5dc;hp=23a12a9d6bac9dbd0905f186c018a4c3c2ef5776;hpb=2178218dbe9007bee3a614b592f630f0b74924b8;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 23a12a9..4117aff 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -2982,19 +2982,21 @@ func TestRESTSubReqRetransmissionV2(t *testing.T) { queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + mainCtrl.WaitOngoingRequestMapEmpty() + //1.st resend restSubId_resend := xappConn1.SendRESTSubsReq(t, params) assert.Equal(t, restSubId_resend, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() //2.nd resend restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) assert.Equal(t, restSubId_resend2, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() deleteSubscription(t, xappConn1, e2termConn1, &restSubId) @@ -3066,7 +3068,7 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() //1.st resend with subscription ID params.SetSubscriptionID(&restSubId) @@ -3074,7 +3076,7 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { assert.Equal(t, restSubId_resend, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() //2.nd resend without subscription ID (faking app restart) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -3082,7 +3084,7 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { assert.Equal(t, restSubId_resend2, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() deleteSubscription(t, xappConn1, e2termConn1, &restSubId) @@ -3168,7 +3170,7 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Send modified requst, this time with e2 subscriptions. params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) @@ -3189,7 +3191,7 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) assert.NotEqual(t, e2SubsId2, 0) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -3202,6 +3204,8 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) assert.Equal(t, e2SubsId, e2SubsId1) + mainCtrl.WaitOngoingRequestMapEmpty() + // Delete both e2 subscriptions xappConn1.SendRESTSubsDelReq(t, &restSubId) e2SubsIds := []uint32{e2SubsId, e2SubsId2} @@ -3289,7 +3293,7 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Send modified request, this time with e2 subscriptions. params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) @@ -3312,7 +3316,7 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) assert.NotEqual(t, e2SubsId2, 0) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -3325,6 +3329,8 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) assert.Equal(t, e2SubsId, e2SubsId1) + mainCtrl.WaitOngoingRequestMapEmpty() + // Delete both e2 subscriptions xappConn1.SendRESTSubsDelReq(t, &restSubId) e2SubsIds := []uint32{e2SubsId, e2SubsId2} @@ -3421,7 +3427,7 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Send modified requst, this time with e2 subscriptions. params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) @@ -3442,7 +3448,7 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) assert.NotEqual(t, e2SubsId2, 0) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Delete both e2 subscriptions xappConn1.SendRESTSubsDelReq(t, &restSubId) @@ -3456,7 +3462,7 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { // fresh create. restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() deleteSubscription(t, xappConn1, e2termConn1, &restSubId)