Restored UT cases + reduced UT run time
[ric-plt/submgr.git] / pkg / control / sdl_test.go
index 6b3ca0b..2fac9b2 100644 (file)
@@ -22,15 +22,17 @@ package control
 import (
        "encoding/json"
        "fmt"
-       "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
-       "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap"
-       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
-       "github.com/stretchr/testify/assert"
        "reflect"
        "strconv"
        "strings"
+       "sync"
        "testing"
        "time"
+
+       "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
+       "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+       "github.com/stretchr/testify/assert"
 )
 
 var sdlShouldReturnError bool = false
@@ -48,6 +50,7 @@ type Mock struct {
        register           map[uint32]*Subscription
        subIds             []uint32
        lastAllocatedSubId uint32
+       marshalLock        sync.Mutex
 }
 
 var mock *Mock
@@ -464,6 +467,9 @@ func (m *Mock) Set(pairs ...interface{}) error {
        var key string
        var val string
 
+       m.marshalLock.Lock()
+       defer m.marshalLock.Unlock()
+
        if sdlShouldReturnError == true {
                return GetSdlError()
        }