summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/rb/definition_test.go
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-12-15 00:34:27 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-15 00:34:27 +0000
commit2da9b6c0498528a6eac478fa7b334906457f7b82 (patch)
treebe33f0fadf12c321c9a20eaf943eda5b43335948 /src/k8splugin/rb/definition_test.go
parentb878686931d404568af000df1f0f86927a730680 (diff)
parentd203ccf9174e450b6f5a6a9aabea95b73c9973ff (diff)
Merge "Migrating from consul to mongodb for backend"
Diffstat (limited to 'src/k8splugin/rb/definition_test.go')
-rw-r--r--src/k8splugin/rb/definition_test.go47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/k8splugin/rb/definition_test.go b/src/k8splugin/rb/definition_test.go
index 58eb718d..1e488678 100644
--- a/src/k8splugin/rb/definition_test.go
+++ b/src/k8splugin/rb/definition_test.go
@@ -24,7 +24,6 @@ import (
"strings"
"testing"
- "github.com/hashicorp/consul/api"
pkgerrors "github.com/pkg/errors"
)
@@ -110,21 +109,17 @@ func TestList(t *testing.T) {
},
expectedError: "",
mockdb: &db.MockDB{
- Items: api.KVPairs{
- &api.KVPair{
- Key: "rb/def/123e4567-e89b-12d3-a456-426655440000",
- Value: []byte("{\"name\":\"testresourcebundle\"," +
+ Items: map[string][]byte{
+ "123e4567-e89b-12d3-a456-426655440000": []byte(
+ "{\"name\":\"testresourcebundle\"," +
"\"description\":\"testresourcebundle\"," +
"\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"," +
"\"service-type\":\"firewall\"}"),
- },
- &api.KVPair{
- Key: "rb/def/123e4567-e89b-12d3-a456-426655441111",
- Value: []byte("{\"name\":\"testresourcebundle2\"," +
+ "123e4567-e89b-12d3-a456-426655441111": []byte(
+ "{\"name\":\"testresourcebundle2\"," +
"\"description\":\"testresourcebundle2\"," +
"\"uuid\":\"123e4567-e89b-12d3-a456-426655441111\"," +
"\"service-type\":\"dns\"}"),
- },
},
},
},
@@ -179,14 +174,12 @@ func TestGet(t *testing.T) {
},
expectedError: "",
mockdb: &db.MockDB{
- Items: api.KVPairs{
- &api.KVPair{
- Key: "rb/def/123e4567-e89b-12d3-a456-426655440000",
- Value: []byte("{\"name\":\"testresourcebundle\"," +
+ Items: map[string][]byte{
+ "123e4567-e89b-12d3-a456-426655440000": []byte(
+ "{\"name\":\"testresourcebundle\"," +
"\"description\":\"testresourcebundle\"," +
"\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"," +
"\"service-type\":\"firewall\"}"),
- },
},
},
},
@@ -293,14 +286,12 @@ func TestUpload(t *testing.T) {
0x4a, 0xf9, 0x00, 0x28, 0x00, 0x00,
},
mockdb: &db.MockDB{
- Items: api.KVPairs{
- &api.KVPair{
- Key: "rb/def/123e4567-e89b-12d3-a456-426655440000",
- Value: []byte("{\"name\":\"testresourcebundle\"," +
+ Items: map[string][]byte{
+ "123e4567-e89b-12d3-a456-426655440000": []byte(
+ "{\"name\":\"testresourcebundle\"," +
"\"description\":\"testresourcebundle\"," +
"\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"," +
"\"service-type\":\"firewall\"}"),
- },
},
},
},
@@ -330,14 +321,12 @@ func TestUpload(t *testing.T) {
0x4a, 0xf9, 0x00, 0x28, 0x00, 0x00,
},
mockdb: &db.MockDB{
- Items: api.KVPairs{
- &api.KVPair{
- Key: "rb/def/123e4567-e89b-12d3-a456-426655441111",
- Value: []byte("{\"name\":\"testresourcebundle\"," +
+ Items: map[string][]byte{
+ "123e4567-e89b-12d3-a456-426655441111": []byte(
+ "{\"name\":\"testresourcebundle\"," +
"\"description\":\"testresourcebundle\"," +
"\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"," +
"\"service-type\":\"firewall\"}"),
- },
},
},
},
@@ -350,14 +339,12 @@ func TestUpload(t *testing.T) {
0x00, 0xff, 0xf2, 0x48, 0xcd,
},
mockdb: &db.MockDB{
- Items: api.KVPairs{
- &api.KVPair{
- Key: "rb/def/123e4567-e89b-12d3-a456-426655440000",
- Value: []byte("{\"name\":\"testresourcebundle\"," +
+ Items: map[string][]byte{
+ "123e4567-e89b-12d3-a456-426655440000": []byte(
+ "{\"name\":\"testresourcebundle\"," +
"\"description\":\"testresourcebundle\"," +
"\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"," +
"\"service-type\":\"firewall\"}"),
- },
},
},
},