diff options
author | 2019-05-23 13:50:50 -0700 | |
---|---|---|
committer | 2019-05-23 19:28:22 -0700 | |
commit | 5207bd099a84832a5d7c3333bf540fa8481ce78a (patch) | |
tree | b6f3aaea641ceb3406dc1c14c7d642098558129f /src/k8splugin/api/instancehandler_test.go | |
parent | 525023e1d288bbf9cf59584c5b5dd37d83be7a4b (diff) |
Update broker responses to match spec and SO
The broker responses need to match the spec and
what SO expects as responses.
CREATE_COMPLETE instead of CREATED in both POST and GET
DELETE now returns a response body
GET by name is now supported
Name is an alias for vf_module_id which is expected to be provided
as an attribute in sdnc_directives in the original POST request
Issue-ID: MULTICLOUD-645
Change-Id: Ifeca755a07298d0a858cbe9e80f9ce654d6d21b8
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api/instancehandler_test.go')
-rw-r--r-- | src/k8splugin/api/instancehandler_test.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/k8splugin/api/instancehandler_test.go b/src/k8splugin/api/instancehandler_test.go index 2e2450ed..dac7db00 100644 --- a/src/k8splugin/api/instancehandler_test.go +++ b/src/k8splugin/api/instancehandler_test.go @@ -58,6 +58,14 @@ func (m *mockInstanceClient) Get(id string) (app.InstanceResponse, error) { return m.items[0], nil } +func (m *mockInstanceClient) Find(rbName string, ver string, profile string, labelKeys map[string]string) ([]app.InstanceResponse, error) { + if m.err != nil { + return nil, m.err + } + + return m.items, nil +} + func (m *mockInstanceClient) Delete(id string) error { return m.err } @@ -104,14 +112,14 @@ func TestInstanceCreateHandler(t *testing.T) { "profile-name": "profile1" }`)), expected: app.InstanceResponse{ - ID: "HaKpys8e", + ID: "HaKpys8e", Request: app.InstanceRequest{ RBName: "test-rbdef", RBVersion: "v1", ProfileName: "profile1", CloudRegion: "region1", }, - Namespace: "testnamespace", + Namespace: "testnamespace", Resources: []helm.KubernetesResource{ { GVK: schema.GroupVersionKind{ @@ -133,14 +141,14 @@ func TestInstanceCreateHandler(t *testing.T) { instClient: &mockInstanceClient{ items: []app.InstanceResponse{ { - ID: "HaKpys8e", + ID: "HaKpys8e", Request: app.InstanceRequest{ RBName: "test-rbdef", RBVersion: "v1", ProfileName: "profile1", CloudRegion: "region1", }, - Namespace: "testnamespace", + Namespace: "testnamespace", Resources: []helm.KubernetesResource{ { GVK: schema.GroupVersionKind{ @@ -207,14 +215,14 @@ func TestInstanceGetHandler(t *testing.T) { input: "HaKpys8e", expectedCode: http.StatusOK, expectedResponse: &app.InstanceResponse{ - ID: "HaKpys8e", + ID: "HaKpys8e", Request: app.InstanceRequest{ RBName: "test-rbdef", RBVersion: "v1", ProfileName: "profile1", CloudRegion: "region1", }, - Namespace: "testnamespace", + Namespace: "testnamespace", Resources: []helm.KubernetesResource{ { GVK: schema.GroupVersionKind{ @@ -235,14 +243,14 @@ func TestInstanceGetHandler(t *testing.T) { instClient: &mockInstanceClient{ items: []app.InstanceResponse{ { - ID: "HaKpys8e", + ID: "HaKpys8e", Request: app.InstanceRequest{ RBName: "test-rbdef", RBVersion: "v1", ProfileName: "profile1", CloudRegion: "region1", }, - Namespace: "testnamespace", + Namespace: "testnamespace", Resources: []helm.KubernetesResource{ { GVK: schema.GroupVersionKind{ |