Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
fix units
Browse files Browse the repository at this point in the history
  • Loading branch information
polskikiel committed Jul 14, 2020
1 parent 8f82c83 commit 27a158f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 147 deletions.
68 changes: 0 additions & 68 deletions pkg/webhook/servicecatalog/servicebinding/mutation/handler_test.go
Expand Up @@ -104,37 +104,6 @@ func TestCreateUpdateHandlerHandleCreateSuccess(t *testing.T) {
},
},
},
"Should clear out the manually set UserInfo field": {
givenRawObj: []byte(`{
"apiVersion": "servicecatalog.k8s.io/v1beta1",
"kind": "ServiceBinding",
"metadata": {
"creationTimestamp": null,
"name": "test-binding"
},
"spec": {
"instanceRef": {
"name": "some-instance"
},
"externalID": "my-external-id-123",
"secretName": "overridden-name",
"userInfo": {
"username": "foo@bar.com",
"uid": "123-123",
"groups": ["val1", "val2"]
}
}
}`),
expPatches: []jsonpatch.Operation{
{
Operation: "add",
Path: "/metadata/finalizers",
Value: []interface{}{
"kubernetes-incubator/service-catalog",
},
},
},
},
}

for tn, tc := range tests {
Expand Down Expand Up @@ -327,43 +296,6 @@ func TestCreateUpdateHandlerHandleSetUserInfoIfOriginatingIdentityIsEnabled(t *t
},
},
},
"Should clear out the ClusterServicePlanRef2": {
reqOperation: admissionv1beta1.Delete,
givenRawObj: []byte(`{
"apiVersion": "servicecatalog.k8s.io/v1beta1",
"kind": "ServiceBinding",
"metadata": {
"finalizers": ["kubernetes-incubator/service-catalog"],
"creationTimestamp": null,
"name": "test-binding"
},
"spec": {
"instanceRef": {
"name": "some-instance"
},
"externalID": "123-abc",
"secretName": "test-binding"
}
}`),
expPatches: []jsonpatch.Operation{
{
Operation: "add",
Path: "/spec/userInfo",
Value: map[string]interface{}{
"username": "minikube",
"uid": "123",
"groups": []interface{}{
"unauthorized",
},
"extra": map[string]interface{}{
"extra": []interface{}{
"val1", "val2",
},
},
},
},
},
},
}

for tn, tc := range tests {
Expand Down
Expand Up @@ -127,6 +127,10 @@ func TestCreateUpdateHandlerHandleCreateSuccess(t *testing.T) {
"kubernetes-incubator/service-catalog",
},
},
{
Operation: "remove",
Path: "/spec/userInfo",
},
},
},
}
Expand Down Expand Up @@ -228,49 +232,6 @@ func TestCreateUpdateHandlerHandleUpdateSuccess(t *testing.T) {
},
},
},
"Should clear out the manually set UserInfo field": {
givenOldRawObj: []byte(`{
"apiVersion": "servicecatalog.k8s.io/v1beta1",
"kind": "ServiceInstance",
"metadata": {
"creationTimestamp": null,
"name": "test-instance",
"generation": 1
},
"spec": {
"updateRequests": 1,
"clusterServiceClassExternalName": "some-class",
"clusterServicePlanExternalName": "some-plan",
"externalID": "external-id-001"
}
}`),
givenNewRawObj: []byte(`{
"apiVersion": "servicecatalog.k8s.io/v1beta1",
"kind": "ServiceInstance",
"metadata": {
"creationTimestamp": null,
"name": "test-instance",
"generation": 1
},
"spec": {
"updateRequests": 1,
"clusterServiceClassExternalName": "some-class",
"clusterServicePlanExternalName": "some-plan",
"externalID": "external-id-001",
"userInfo": {
"username": "foo@bar.com",
"uid": "123-123",
"groups": ["val1", "val2"]
}
}
}`),
expPatches: []jsonpatch.Operation{
{
Operation: "remove",
Path: "/spec/userInfo",
},
},
},
}

for tn, tc := range tests {
Expand Down Expand Up @@ -366,42 +327,6 @@ func TestCreateUpdateHandlerHandleSetUserInfoIfOriginatingIdentityIsEnabled(t *t
},
},
},
"Should clear out the ClusterServicePlanRef2": {
reqOperation: admissionv1beta1.Delete,
givenRawObj: []byte(`{
"apiVersion": "servicecatalog.k8s.io/v1beta1",
"kind": "ServiceInstance",
"metadata": {
"finalizers": [ "kubernetes-incubator/service-catalog" ],
"creationTimestamp": null,
"name": "test-instance"
},
"spec": {
"updateRequests": 1,
"clusterServiceClassExternalName": "some-class",
"clusterServicePlanExternalName": "some-plan",
"externalID": "my-external-id-123"
}
}`),
expPatches: []jsonpatch.Operation{
{
Operation: "add",
Path: "/spec/userInfo",
Value: map[string]interface{}{
"username": "minikube",
"uid": "123",
"groups": []interface{}{
"unauthorized",
},
"extra": map[string]interface{}{
"extra": []interface{}{
"val1", "val2",
},
},
},
},
},
},
}

for tn, tc := range tests {
Expand Down

0 comments on commit 27a158f

Please sign in to comment.