diff options
author | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-02-24 21:59:44 +0000 |
---|---|---|
committer | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-03-03 23:08:13 +0000 |
commit | 37aed9b7a0db62b9931d89c614ff6291cc4608cc (patch) | |
tree | 51021b0776978d77c4a1cad455be582a4dafa894 /src/orchestrator/pkg/infra/db/mock.go | |
parent | 7b566f2875230e15f79a6549b17240e767cc98f1 (diff) |
Implemented AppIntents and GenPlaceIntents
Implemented the routes for creating,
getting, and deleting generic placement intents
and App intents.
Issue-ID: MULTICLOUD-875
Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com>
Change-Id: Iecb11c442958a43a517772e066de45213e3d7030
Diffstat (limited to 'src/orchestrator/pkg/infra/db/mock.go')
-rw-r--r-- | src/orchestrator/pkg/infra/db/mock.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/orchestrator/pkg/infra/db/mock.go b/src/orchestrator/pkg/infra/db/mock.go index 6b46a524..79366d10 100644 --- a/src/orchestrator/pkg/infra/db/mock.go +++ b/src/orchestrator/pkg/infra/db/mock.go @@ -45,6 +45,10 @@ func (m *MockDB) Create(table string, key Key, tag string, data interface{}) err return m.Err } +func (m *MockDB) Insert(table string, key Key, query interface{}, tag string, data interface{}) error { + return m.Err +} + func (m *MockDB) Update(table string, key Key, tag string, data interface{}) error { return m.Err } @@ -73,7 +77,22 @@ func (m *MockDB) Read(table string, key Key, tag string) ([]byte, error) { return nil, m.Err } +func (m *MockDB) Find(table string, key Key, tag string) ([][]byte, error) { + if m.Err != nil { + return nil, m.Err + } + + str := fmt.Sprintf("%v", key) + for k, v := range m.Items { + if k == str { + + return [][]byte{v[tag]}, nil + } + } + + return nil, m.Err +} + func (m *MockDB) Delete(table string, key Key, tag string) error { return m.Err } - |