aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/db/etcd_testing.go
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-08-02 22:15:35 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-08-02 22:30:16 +0200
commit91fe5c50c2d882a5c831dd473d8db765b2dd8699 (patch)
treea2c42ea34ea265b7ef72c237ece1c19b231be8c4 /src/k8splugin/internal/db/etcd_testing.go
parente42203ee6c170eebb9466ee82baa97f83e88955c (diff)
Config List handler added to Config API
Config List handler added to Config API Issue-ID: MULTICLOUD-1332 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: I63355dd6b05e70398cfc89744efa332926286c40
Diffstat (limited to 'src/k8splugin/internal/db/etcd_testing.go')
-rw-r--r--src/k8splugin/internal/db/etcd_testing.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/k8splugin/internal/db/etcd_testing.go b/src/k8splugin/internal/db/etcd_testing.go
index 12b17e33..9dfcad82 100644
--- a/src/k8splugin/internal/db/etcd_testing.go
+++ b/src/k8splugin/internal/db/etcd_testing.go
@@ -14,6 +14,8 @@ limitations under the License.
package db
import (
+ "strings"
+
pkgerrors "github.com/pkg/errors"
)
@@ -39,6 +41,16 @@ func (c *MockEtcdClient) Get(key string) ([]byte, error) {
return nil, pkgerrors.Errorf("Key doesn't exist")
}
+func (c *MockEtcdClient) GetAll(key string) ([][]byte, error) {
+ result := make([][]byte, 0)
+ for kvKey, kvValue := range c.Items {
+ if strings.HasPrefix(kvKey, key) {
+ result = append(result, []byte(kvValue))
+ }
+ }
+ return result, nil
+}
+
func (c *MockEtcdClient) Delete(key string) error {
delete(c.Items, key)
return c.Err