- Some fixed delays replaced with function which tests that test case can contiue
- This should reduce random test failuers
Change-Id: Ic4003aefe280e80d0fdb033d4cbcf51f312e2fcb
Signed-off-by: Anssi Mannila <anssi.mannila@nokia.com>
}
}
<-time.After(time.Millisecond * 100)
}
}
<-time.After(time.Millisecond * 100)
- mc.TestLog(t, "VerifyAllClean delay plus 100ms")
+ xapp.Logger.Debug("VerifyAllClean delay plus 100ms")
}
assert.Equal(t, 0, len(mainCtrl.c.registry.register))
}
assert.Equal(t, 0, len(mainCtrl.c.registry.register))
+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")
+ }
+ }
+}
+
func (mc *testingSubmgrControl) GetMetrics(t *testing.T) (string, error) {
req, err := http.NewRequest("GET", "http://localhost:8080/ric/v1/metrics", nil)
if err != nil {
func (mc *testingSubmgrControl) GetMetrics(t *testing.T) (string, error) {
req, err := http.NewRequest("GET", "http://localhost:8080/ric/v1/metrics", nil)
if err != nil {
queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"})
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)
//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)
//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)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"})
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)
//1.st resend with subscription ID
params.SetSubscriptionID(&restSubId)
assert.Equal(t, restSubId_resend, restSubId)
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)
//2.nd resend without subscription ID (faking app restart)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
assert.Equal(t, restSubId_resend2, restSubId)
assert.Equal(t, restSubId_resend2, restSubId)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
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)
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
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)
xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
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)
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
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)
xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
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)
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
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)
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
// fresh create.
restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params)
// fresh create.
restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)