Code Review
/
ric-plt
/
submgr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Support for handling unordered IEs in RIC Subscription Response messgae
[ric-plt/submgr.git]
/
pkg
/
control
/
sdl_e2SubsDb_test.go
diff --git
a/pkg/control/sdl_e2SubsDb_test.go
b/pkg/control/sdl_e2SubsDb_test.go
index
2deb4b5
..
ab3462a
100644
(file)
--- a/
pkg/control/sdl_e2SubsDb_test.go
+++ b/
pkg/control/sdl_e2SubsDb_test.go
@@
-158,6
+158,8
@@
func GetSubsFailure(t *testing.T, req *e2ap.E2APSubscriptionRequest) *e2ap.E2APS
fail.RequestId.Id = req.RequestId.Id
fail.RequestId.InstanceId = req.RequestId.InstanceId
fail.FunctionId = req.FunctionId
fail.RequestId.Id = req.RequestId.Id
fail.RequestId.InstanceId = req.RequestId.InstanceId
fail.FunctionId = req.FunctionId
+ fail.Cause.Content = e2ap.E2AP_CauseContent_RICrequest
+ fail.Cause.Value = e2ap.E2AP_CauseValue_RICrequest_control_message_invalid
return fail
}
return fail
}
@@
-198,6
+200,17
@@
func TestWriteSubscriptionToSdl(t *testing.T) {
if err != nil {
t.Errorf("TEST: %s", err.Error())
}
if err != nil {
t.Errorf("TEST: %s", err.Error())
}
+ verifyE2KeyCount(t, 1)
+}
+
+func verifyE2KeyCount(t *testing.T, expectedCount int) {
+
+ count, err := mainCtrl.c.GetE2KeyCount()
+ if err != nil {
+ t.Errorf("TEST: %s", err.Error())
+ } else {
+ assert.Equal(t, expectedCount, count)
+ }
}
func TestReadSubscriptionFromSdl(t *testing.T) {
}
func TestReadSubscriptionFromSdl(t *testing.T) {
@@
-463,13
+476,17
@@
func TestRemoveAllSubscriptionsFromSdlFail(t *testing.T) {
t.Log("TEST: All subscription removed from db")
}
t.Log("TEST: All subscription removed from db")
}
-func (m *Mock) Set(pairs ...interface{}) error {
+func (m *Mock) Set(
ns string,
pairs ...interface{}) error {
var key string
var val string
m.marshalLock.Lock()
defer m.marshalLock.Unlock()
var key string
var val string
m.marshalLock.Lock()
defer m.marshalLock.Unlock()
+ if ns != e2SubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if sdlShouldReturnError == true {
return GetSdlError()
}
if sdlShouldReturnError == true {
return GetSdlError()
}
@@
-507,8
+524,13
@@
func (m *Mock) Set(pairs ...interface{}) error {
return nil
}
return nil
}
-func (m *Mock) Get(keys []string) (map[string]interface{}, error) {
+func (m *Mock) Get(
ns string,
keys []string) (map[string]interface{}, error) {
retMap := make(map[string]interface{})
retMap := make(map[string]interface{})
+
+ if ns != e2SubSdlNs {
+ return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if len(keys) == 0 {
return nil, fmt.Errorf("Get() error: len(key) == 0\n")
}
if len(keys) == 0 {
return nil, fmt.Errorf("Get() error: len(key) == 0\n")
}
@@
-527,7
+549,11
@@
func (m *Mock) Get(keys []string) (map[string]interface{}, error) {
return retMap, nil
}
return retMap, nil
}
-func (m *Mock) GetAll() ([]string, error) {
+func (m *Mock) GetAll(ns string) ([]string, error) {
+
+ if ns != e2SubSdlNs {
+ return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
if sdlShouldReturnError == true {
return nil, GetSdlError()
if sdlShouldReturnError == true {
return nil, GetSdlError()
@@
-540,7
+566,12
@@
func (m *Mock) GetAll() ([]string, error) {
return keys, nil
}
return keys, nil
}
-func (m *Mock) Remove(keys []string) error {
+func (m *Mock) Remove(ns string, keys []string) error {
+
+ if ns != e2SubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if len(keys) == 0 {
return fmt.Errorf("Remove() error: len(key) == 0\n")
}
if len(keys) == 0 {
return fmt.Errorf("Remove() error: len(key) == 0\n")
}
@@
-560,7
+591,11
@@
func (m *Mock) Remove(keys []string) error {
return nil
}
return nil
}
-func (m *Mock) RemoveAll() error {
+func (m *Mock) RemoveAll(ns string) error {
+
+ if ns != e2SubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
for key := range m.e2SubsDb {
subId64, err := strconv.ParseUint(key, 10, 64)
for key := range m.e2SubsDb {
subId64, err := strconv.ParseUint(key, 10, 64)