aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/db/etcd_testing.go
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2022-02-03 19:18:07 +0100
committerLukasz Rajewski <lukasz.rajewski@orange.com>2022-02-23 14:27:01 +0100
commit88ecb1f9dfeded36e7fd74c776daefcaf67f8ae2 (patch)
tree321eb34967dd32a43d7e3ac62b5fd664e5b2231b /src/k8splugin/internal/db/etcd_testing.go
parent1f92a0ec4ea037089b82e3f80bb030f34fab64f0 (diff)
ConfigAPI and Query API improvements
- Config Template create from the definition content - Missing CRUD Config handlers added - Improved Rollback and Config delete - Query API name filtering improved Issue-ID: MULTICLOUD-1437 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: Iec8ec6d03746085f294d9318a252f1ae45d3b9c8
Diffstat (limited to 'src/k8splugin/internal/db/etcd_testing.go')
-rw-r--r--src/k8splugin/internal/db/etcd_testing.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/k8splugin/internal/db/etcd_testing.go b/src/k8splugin/internal/db/etcd_testing.go
index 4b4dfe3e..2f62d365 100644
--- a/src/k8splugin/internal/db/etcd_testing.go
+++ b/src/k8splugin/internal/db/etcd_testing.go
@@ -41,7 +41,17 @@ func (c *MockEtcdClient) Get(key string) ([]byte, error) {
return nil, pkgerrors.Errorf("Key doesn't exist")
}
-func (c *MockEtcdClient) GetAll(key string) ([][]byte, error) {
+func (c *MockEtcdClient) GetKeys(key string) ([]string, error) {
+ result := make([]string, 0)
+ for kvKey := range c.Items {
+ if strings.HasPrefix(kvKey, key) {
+ result = append(result, kvKey)
+ }
+ }
+ return result, nil
+}
+
+func (c *MockEtcdClient) GetValues(key string) ([][]byte, error) {
result := make([][]byte, 0)
for kvKey, kvValue := range c.Items {
if strings.HasPrefix(kvKey, key) {