+func (mc *testingSubmgrControl) VerifyAllClean(t *testing.T) {
+
+ // Verify that all resources are freed. Wait cleaning up to 10 seconds
+ for i := 0; i < 100; i++ {
+ if len(mainCtrl.c.registry.register) == 0 && len(mainCtrl.c.registry.restSubscriptions) == 0 {
+ RESTKeyCount, err := mainCtrl.c.GetRESTKeyCount()
+ if err != nil {
+ t.Errorf("TEST: %s", err.Error())
+ }
+ E2KeyCount, err := mainCtrl.c.GetE2KeyCount()
+ if err != nil {
+ t.Errorf("TEST: %s", err.Error())
+ }
+ if RESTKeyCount == 0 && E2KeyCount == 0 {
+ break
+ }
+ }
+ xapp.Logger.Debug("VerifyAllClean. Adding 100ms more delay to complete")
+ <-time.After(time.Millisecond * 100)
+ }
+
+ assert.Equal(t, 0, len(mainCtrl.c.registry.register))
+ if len(mainCtrl.c.registry.register) > 0 {
+ fmt.Printf("registry.register: %v\n", mainCtrl.c.registry.register)
+ }
+ assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions))
+ if len(mainCtrl.c.registry.restSubscriptions) > 0 {
+ fmt.Printf("registry.restSubscriptions: %v\n", mainCtrl.c.registry.restSubscriptions)
+ }
+ verifyRESTKeyCount(t, 0)
+ verifyE2KeyCount(t, 0)
+}
+
+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. Adding 100ms more delay to complete")
+ }
+ }
+}
+
+func (mc *testingSubmgrControl) WaitRESTSubscriptionDelete(restSubsId string) {
+ for i := 0; i < 100; i++ {
+ restSubscription, _ := mainCtrl.c.registry.GetRESTSubscription(restSubsId, false)
+ if restSubscription != nil {
+ xapp.Logger.Debug("WaitRESTSubscriptionDelete. Adding 100ms more delay to complete")
+ <-time.After(time.Millisecond * 100)
+ }
+ }
+}
+