Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SED = sed -i ''
endif
TEST_PACKAGES=$(shell go list ./... | egrep "controllers|internal/utils|api|client" | egrep -v "client/sm/smfakes" | paste -sd " " -)

GO_TEST = go test $(TEST_PACKAGES) -coverprofile=$(TEST_PROFILE) -ginkgo.flakeAttempts=3
GO_TEST = go test $(TEST_PACKAGES) -coverprofile=$(TEST_PROFILE) -ginkgo.flakeAttempts=2

all: manager

Expand Down
9 changes: 1 addition & 8 deletions api/v1/serviceinstance_validating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ func (si *ServiceInstance) ValidateCreate(_ context.Context, _ runtime.Object) (
return nil, nil
}

func (si *ServiceInstance) ValidateUpdate(_ context.Context, oldObj, newObj runtime.Object) (warnings admission.Warnings, err error) {
oldInstance := oldObj.(*ServiceInstance)
newInstance := newObj.(*ServiceInstance)
serviceinstancelog.Info("validate update", "name", newInstance.ObjectMeta.Name)

if oldInstance.Spec.BTPAccessCredentialsSecret != newInstance.Spec.BTPAccessCredentialsSecret {
return nil, fmt.Errorf("changing the btpAccessCredentialsSecret for an existing instance is not allowed")
}
func (si *ServiceInstance) ValidateUpdate(_ context.Context, _, _ runtime.Object) (warnings admission.Warnings, err error) {
return nil, nil
}

Expand Down
14 changes: 0 additions & 14 deletions api/v1/serviceinstance_validating_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@ var _ = Describe("Service Instance Webhook Test", func() {
instance = getInstance()
})

Context("Validate Update", func() {
When("btpAccessCredentialsSecret changed", func() {
It("should fail", func() {
instance := getInstance()
instance.Spec.BTPAccessCredentialsSecret = ""
newInstance := getInstance()
newInstance.Spec.BTPAccessCredentialsSecret = "new-secret"
_, err := newInstance.ValidateUpdate(nil, instance, newInstance)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("changing the btpAccessCredentialsSecret for an existing instance is not allowed"))
})
})
})

Context("Validate Delete", func() {
When("service instance is marked as prevent deletion", func() {
It("should return error from webhook", func() {
Expand Down
11 changes: 0 additions & 11 deletions controllers/serviceinstance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,17 +606,6 @@ var _ = Describe("ServiceInstance controller", func() {
})
})

When("subaccount id changed", func() {
It("should fail", func() {
deleteInstance(ctx, serviceInstance, true)
serviceInstance = createInstance(ctx, fakeInstanceName, instanceSpec, nil, true)
serviceInstance.Spec.BTPAccessCredentialsSecret = "12345"
err := k8sClient.Update(ctx, serviceInstance)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("changing the btpAccessCredentialsSecret for an existing instance is not allowed"))
})
})

When("UserInfo changed", func() {
It("should fail", func() {
serviceInstance.Spec.UserInfo = &authv1.UserInfo{
Expand Down
Loading