diff options
Diffstat (limited to 'src/k8splugin/internal/db')
-rw-r--r-- | src/k8splugin/internal/db/consul_test.go | 14 | ||||
-rw-r--r-- | src/k8splugin/internal/db/mongo_test.go | 22 | ||||
-rw-r--r-- | src/k8splugin/internal/db/testing.go | 4 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/k8splugin/internal/db/consul_test.go b/src/k8splugin/internal/db/consul_test.go index 6d127841..abd264c8 100644 --- a/src/k8splugin/internal/db/consul_test.go +++ b/src/k8splugin/internal/db/consul_test.go @@ -108,13 +108,13 @@ func TestConsulCreate(t *testing.T) { }{ { label: "Sucessful register a record to Consul Database", - key: mockKey{Key: "test-key"}, + key: MockKey{Key: "test-key"}, input: map[string]string{"root": "rbinst", "tag": "data", "value": "test-value"}, mock: &mockConsulKVStore{}, }, { label: "Fail to create a new record in Consul Database", - key: mockKey{Key: "test-key"}, + key: MockKey{Key: "test-key"}, input: map[string]string{"root": "rbinst", "tag": "data", "value": "test-value"}, mock: &mockConsulKVStore{ Err: pkgerrors.New("DB error"), @@ -151,7 +151,7 @@ func TestConsulRead(t *testing.T) { }{ { label: "Sucessful retrieve a record from Consul Database", - key: mockKey{Key: "test"}, + key: MockKey{Key: "test"}, input: map[string]string{"root": "rbinst", "tag": "data"}, mock: &mockConsulKVStore{ Items: api.KVPairs{ @@ -165,13 +165,13 @@ func TestConsulRead(t *testing.T) { }, { label: "Fail retrieve a non-existing record from Consul Database", - key: mockKey{Key: "test-key"}, + key: MockKey{Key: "test-key"}, input: map[string]string{"root": "rbinst", "tag": "data"}, mock: &mockConsulKVStore{}, }, { label: "Fail retrieve a record from Consul Database", - key: mockKey{Key: "test-key"}, + key: MockKey{Key: "test-key"}, input: map[string]string{"root": "rbinst", "tag": "data"}, mock: &mockConsulKVStore{ Err: pkgerrors.New("DB error"), @@ -215,13 +215,13 @@ func TestConsulDelete(t *testing.T) { }{ { label: "Sucessful delete a record to Consul Database", - key: mockKey{Key: "test-key"}, + key: MockKey{Key: "test-key"}, input: map[string]string{"root": "rbinst", "tag": "data"}, mock: &mockConsulKVStore{}, }, { label: "Fail to delete a record in Consul Database", - key: mockKey{Key: "test-key"}, + key: MockKey{Key: "test-key"}, mock: &mockConsulKVStore{ Err: pkgerrors.New("DB error"), }, diff --git a/src/k8splugin/internal/db/mongo_test.go b/src/k8splugin/internal/db/mongo_test.go index deb51044..baa442ce 100644 --- a/src/k8splugin/internal/db/mongo_test.go +++ b/src/k8splugin/internal/db/mongo_test.go @@ -84,7 +84,7 @@ func TestCreate(t *testing.T) { label: "Successfull creation of entry", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "tagName", "data": "Data In String Format", }, @@ -95,7 +95,7 @@ func TestCreate(t *testing.T) { label: "UnSuccessfull creation of entry", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "tagName", "data": "Data In String Format", }, @@ -108,7 +108,7 @@ func TestCreate(t *testing.T) { label: "Missing input fields", input: map[string]interface{}{ "coll": "", - "key": mockKey{Key: ""}, + "key": MockKey{Key: ""}, "tag": "", "data": "", }, @@ -156,7 +156,7 @@ func TestRead(t *testing.T) { label: "Successfull Read of entry", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "metadata", }, // Binary form of @@ -186,7 +186,7 @@ func TestRead(t *testing.T) { label: "UnSuccessfull Read of entry: object not found", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "badtag", }, // Binary form of @@ -215,7 +215,7 @@ func TestRead(t *testing.T) { label: "UnSuccessfull Read of entry", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "tagName", }, mockColl: &mockCollection{ @@ -227,7 +227,7 @@ func TestRead(t *testing.T) { label: "Missing input fields", input: map[string]interface{}{ "coll": "", - "key": mockKey{Key: ""}, + "key": MockKey{Key: ""}, "tag": "", }, expectedError: "Mandatory fields are missing", @@ -277,7 +277,7 @@ func TestDelete(t *testing.T) { label: "Successfull Delete of entry", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "metadata", }, // Binary form of @@ -305,7 +305,7 @@ func TestDelete(t *testing.T) { label: "UnSuccessfull Delete of entry", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "tagName", }, mockColl: &mockCollection{ @@ -317,7 +317,7 @@ func TestDelete(t *testing.T) { label: "UnSuccessfull Delete, key not found", input: map[string]interface{}{ "coll": "collname", - "key": mockKey{Key: "keyvalue"}, + "key": MockKey{Key: "keyvalue"}, "tag": "tagName", }, // Binary form of @@ -346,7 +346,7 @@ func TestDelete(t *testing.T) { label: "Missing input fields", input: map[string]interface{}{ "coll": "", - "key": mockKey{Key: ""}, + "key": MockKey{Key: ""}, "tag": "", }, expectedError: "Mandatory fields are missing", diff --git a/src/k8splugin/internal/db/testing.go b/src/k8splugin/internal/db/testing.go index a411790e..e7e7436a 100644 --- a/src/k8splugin/internal/db/testing.go +++ b/src/k8splugin/internal/db/testing.go @@ -20,11 +20,11 @@ import ( pkgerrors "github.com/pkg/errors" ) -type mockKey struct { +type MockKey struct { Key string } -func (m mockKey) String() string { +func (m MockKey) String() string { return m.Key } |