diff options
author | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-04-16 18:09:13 -0700 |
---|---|---|
committer | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-04-16 18:09:27 -0700 |
commit | bf49d552b003072c6bc64ae838a4699c1f4028bd (patch) | |
tree | 57c2b6130781f8215b0544e6b6f126ec8e2f8152 /src/k8splugin/api/instancehandler_test.go | |
parent | 244578803033f17781b10be283aef43fa6f0aa60 (diff) |
Replace Kind with GroupVersionKind
Kind is not unique to track resources in Kubernetes
GroupVersionKind is unique. We are just using that to
track our data. It is abstracted behind a couple of new
types for templates and resources.
This change makes a lot of the old kind based operations
redundant and simplified.
Issue-ID: MULTICLOUD-573
Change-Id: I8f4ded2ba6a0821a8fbd679dc99ce3a44d805524
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 | 74 |
1 files changed, 62 insertions, 12 deletions
diff --git a/src/k8splugin/api/instancehandler_test.go b/src/k8splugin/api/instancehandler_test.go index ed7135a6..6d2abf6f 100644 --- a/src/k8splugin/api/instancehandler_test.go +++ b/src/k8splugin/api/instancehandler_test.go @@ -24,9 +24,11 @@ import ( "testing" "k8splugin/internal/app" + "k8splugin/internal/helm" "github.com/gorilla/mux" pkgerrors "github.com/pkg/errors" + "k8s.io/apimachinery/pkg/runtime/schema" ) //Creating an embedded interface via anonymous variable @@ -108,9 +110,21 @@ func TestInstanceCreateHandler(t *testing.T) { ProfileName: "profile1", CloudRegion: "region1", Namespace: "testnamespace", - Resources: map[string][]string{ - "deployment": []string{"test-deployment"}, - "service": []string{"test-service"}, + Resources: []helm.KubernetesResource{ + { + GVK: schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment"}, + Name: "test-deployment", + }, + { + GVK: schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service"}, + Name: "test-service", + }, }, }, expectedCode: http.StatusCreated, @@ -123,9 +137,21 @@ func TestInstanceCreateHandler(t *testing.T) { ProfileName: "profile1", CloudRegion: "region1", Namespace: "testnamespace", - Resources: map[string][]string{ - "deployment": []string{"test-deployment"}, - "service": []string{"test-service"}, + Resources: []helm.KubernetesResource{ + { + GVK: schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment"}, + Name: "test-deployment", + }, + { + GVK: schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service"}, + Name: "test-service", + }, }, }, }, @@ -183,9 +209,21 @@ func TestInstanceGetHandler(t *testing.T) { ProfileName: "profile1", CloudRegion: "region1", Namespace: "testnamespace", - Resources: map[string][]string{ - "deployment": []string{"test-deployment"}, - "service": []string{"test-service"}, + Resources: []helm.KubernetesResource{ + { + GVK: schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment"}, + Name: "test-deployment", + }, + { + GVK: schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service"}, + Name: "test-service", + }, }, }, instClient: &mockInstanceClient{ @@ -197,9 +235,21 @@ func TestInstanceGetHandler(t *testing.T) { ProfileName: "profile1", CloudRegion: "region1", Namespace: "testnamespace", - Resources: map[string][]string{ - "deployment": []string{"test-deployment"}, - "service": []string{"test-service"}, + Resources: []helm.KubernetesResource{ + { + GVK: schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment"}, + Name: "test-deployment", + }, + { + GVK: schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service"}, + Name: "test-service", + }, }, }, }, |