X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fsdl_test.go;h=2fac9b2c8dcffc0377a4038aace0590285ea532d;hb=refs%2Fchanges%2F13%2F6113%2F1;hp=6b3ca0b3fa451524acfd4f6f3e323211a5c1608f;hpb=39d94ea1dd0e04ee6da8742d133393ce6ed3200c;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/sdl_test.go b/pkg/control/sdl_test.go index 6b3ca0b..2fac9b2 100644 --- a/pkg/control/sdl_test.go +++ b/pkg/control/sdl_test.go @@ -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() }