summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app/instance_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/internal/app/instance_test.go')
-rw-r--r--src/k8splugin/internal/app/instance_test.go174
1 files changed, 98 insertions, 76 deletions
diff --git a/src/k8splugin/internal/app/instance_test.go b/src/k8splugin/internal/app/instance_test.go
index 2fa2115b..87824d74 100644
--- a/src/k8splugin/internal/app/instance_test.go
+++ b/src/k8splugin/internal/app/instance_test.go
@@ -203,12 +203,14 @@ func TestInstanceGet(t *testing.T) {
InstanceKey{ID: "HaKpys8e"}.String(): {
"instance": []byte(
`{
- "profile-name":"profile1",
- "id":"HaKpys8e",
+ "id":"HaKpys8e",
+ "request": {
+ "profile-name":"profile1",
+ "rb-name":"test-rbdef",
+ "rb-version":"v1",
+ "cloud-region":"region1"
+ },
"namespace":"testnamespace",
- "rb-name":"test-rbdef",
- "rb-version":"v1",
- "cloud-region":"region1",
"resources": [
{
"GVK": {
@@ -233,13 +235,14 @@ func TestInstanceGet(t *testing.T) {
}
expected := InstanceResponse{
- ID: "HaKpys8e",
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile1",
- CloudRegion: "region1",
- Namespace: "testnamespace",
-
+ ID: "HaKpys8e",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v1",
+ ProfileName: "profile1",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
GVK: schema.GroupVersionKind{
@@ -275,12 +278,14 @@ func TestInstanceGet(t *testing.T) {
InstanceKey{ID: "HaKpys8e"}.String(): {
"instance": []byte(
`{
- "profile-name":"profile1",
- "id":"HaKpys8e",
+ "id":"HaKpys8e",
+ "request": {
+ "profile-name":"profile1",
+ "rb-name":"test-rbdef",
+ "rb-version":"v1",
+ "cloud-region":"region1"
+ },
"namespace":"testnamespace",
- "rb-name":"test-rbdef",
- "rb-version":"v1",
- "cloud-region":"region1",
"resources": [
{
"GVK": {
@@ -329,12 +334,14 @@ func TestInstanceFind(t *testing.T) {
InstanceKey{ID: "HaKpys8e"}.String(): {
"instance": []byte(
`{
- "profile-name":"profile1",
- "id":"HaKpys8e",
+ "id":"HaKpys8e",
+ "request": {
+ "profile-name":"profile1",
+ "rb-name":"test-rbdef",
+ "rb-version":"v1",
+ "cloud-region":"region1"
+ },
"namespace":"testnamespace",
- "rb-name":"test-rbdef",
- "rb-version":"v1",
- "cloud-region":"region1",
"resources": [
{
"GVK": {
@@ -358,12 +365,14 @@ func TestInstanceFind(t *testing.T) {
InstanceKey{ID: "HaKpys8f"}.String(): {
"instance": []byte(
`{
- "profile-name":"profile2",
- "id":"HaKpys8f",
+ "id":"HaKpys8f",
+ "request": {
+ "profile-name":"profile2",
+ "rb-name":"test-rbdef",
+ "rb-version":"v1",
+ "cloud-region":"region1"
+ },
"namespace":"testnamespace",
- "rb-name":"test-rbdef",
- "rb-version":"v1",
- "cloud-region":"region1",
"resources": [
{
"GVK": {
@@ -387,12 +396,14 @@ func TestInstanceFind(t *testing.T) {
InstanceKey{ID: "HaKpys8g"}.String(): {
"instance": []byte(
`{
- "profile-name":"profile1",
- "id":"HaKpys8g",
+ "id":"HaKpys8g",
+ "request": {
+ "profile-name":"profile1",
+ "rb-name":"test-rbdef",
+ "rb-version":"v2",
+ "cloud-region":"region1"
+ },
"namespace":"testnamespace",
- "rb-name":"test-rbdef",
- "rb-version":"v2",
- "cloud-region":"region1",
"resources": [
{
"GVK": {
@@ -422,13 +433,14 @@ func TestInstanceFind(t *testing.T) {
expected := []InstanceResponse{
{
- ID: "HaKpys8e",
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile1",
- CloudRegion: "region1",
- Namespace: "testnamespace",
-
+ ID: "HaKpys8e",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v1",
+ ProfileName: "profile1",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
GVK: schema.GroupVersionKind{
@@ -447,13 +459,14 @@ func TestInstanceFind(t *testing.T) {
},
},
{
- ID: "HaKpys8f",
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile2",
- CloudRegion: "region1",
- Namespace: "testnamespace",
-
+ ID: "HaKpys8f",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v1",
+ ProfileName: "profile2",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
GVK: schema.GroupVersionKind{
@@ -472,13 +485,14 @@ func TestInstanceFind(t *testing.T) {
},
},
{
- ID: "HaKpys8g",
- RBName: "test-rbdef",
- RBVersion: "v2",
- ProfileName: "profile1",
- CloudRegion: "region1",
- Namespace: "testnamespace",
-
+ ID: "HaKpys8g",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v2",
+ ProfileName: "profile1",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
GVK: schema.GroupVersionKind{
@@ -528,12 +542,14 @@ func TestInstanceFind(t *testing.T) {
expected := []InstanceResponse{
{
- ID: "HaKpys8e",
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile1",
- CloudRegion: "region1",
- Namespace: "testnamespace",
+ ID: "HaKpys8e",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v1",
+ ProfileName: "profile1",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
@@ -553,12 +569,14 @@ func TestInstanceFind(t *testing.T) {
},
},
{
- ID: "HaKpys8f",
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile2",
- CloudRegion: "region1",
- Namespace: "testnamespace",
+ ID: "HaKpys8f",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v1",
+ ProfileName: "profile2",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
@@ -609,12 +627,14 @@ func TestInstanceFind(t *testing.T) {
expected := []InstanceResponse{
{
- ID: "HaKpys8e",
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile1",
- CloudRegion: "region1",
- Namespace: "testnamespace",
+ ID: "HaKpys8e",
+ Request: InstanceRequest{
+ RBName: "test-rbdef",
+ RBVersion: "v1",
+ ProfileName: "profile1",
+ CloudRegion: "region1",
+ },
+ Namespace: "testnamespace",
Resources: []helm.KubernetesResource{
{
@@ -726,12 +746,14 @@ func TestInstanceDelete(t *testing.T) {
InstanceKey{ID: "HaKpys8e"}.String(): {
"instance": []byte(
`{
- "profile-name":"profile1",
- "id":"HaKpys8e",
+ "id":"HaKpys8e",
+ "request": {
+ "profile-name":"profile1",
+ "rb-name":"test-rbdef",
+ "rb-version":"v1",
+ "cloud-region":"mock_connection"
+ },
"namespace":"testnamespace",
- "rb-name":"test-rbdef",
- "rb-version":"v1",
- "cloud-region":"mock_connection",
"resources": [
{
"GVK": {