X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fsdl_e2SubsDb_test.go;h=3175cc9253f73123e7ca81e4fa45e9e49fc6c7df;hb=f0bb66c95fa3f03ae956cc719cc776ed2f2f3bd4;hp=2deb4b5e2a02b71744d7edcb92501c58ae595cb2;hpb=53dbe7eafa69dcea736ba19c66581a80f374b51a;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/sdl_e2SubsDb_test.go b/pkg/control/sdl_e2SubsDb_test.go index 2deb4b5..3175cc9 100644 --- a/pkg/control/sdl_e2SubsDb_test.go +++ b/pkg/control/sdl_e2SubsDb_test.go @@ -463,13 +463,17 @@ func TestRemoveAllSubscriptionsFromSdlFail(t *testing.T) { 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() + if ns != e2SubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if sdlShouldReturnError == true { return GetSdlError() } @@ -507,8 +511,13 @@ func (m *Mock) Set(pairs ...interface{}) error { 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{}) + + 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") } @@ -527,7 +536,11 @@ func (m *Mock) Get(keys []string) (map[string]interface{}, error) { 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() @@ -540,7 +553,12 @@ func (m *Mock) GetAll() ([]string, error) { 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") } @@ -560,7 +578,11 @@ func (m *Mock) Remove(keys []string) error { 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)