Skip to content

Commit

Permalink
chore: printf without parameters is not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
zucchinidev committed Aug 21, 2024
1 parent 978afac commit 502372a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
9 changes: 5 additions & 4 deletions brokerapi/broker/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package broker_test
import (
"context"
"encoding/json"
"errors"
"fmt"

"code.cloudfoundry.org/lager/v3"
Expand Down Expand Up @@ -322,7 +323,7 @@ var _ = Describe("Bind", func() {
const saveError = "credential-save-error"

BeforeEach(func() {
fakeStorage.CreateServiceBindingCredentialsReturns(fmt.Errorf(saveError))
fakeStorage.CreateServiceBindingCredentialsReturns(errors.New(saveError))
})

It("should error", func() {
Expand All @@ -336,7 +337,7 @@ var _ = Describe("Bind", func() {
const saveBindRequestError = "bind-request-save-error"

BeforeEach(func() {
fakeStorage.StoreBindRequestDetailsReturns(fmt.Errorf(saveBindRequestError))
fakeStorage.StoreBindRequestDetailsReturns(errors.New(saveBindRequestError))
})

It("should error", func() {
Expand All @@ -350,7 +351,7 @@ var _ = Describe("Bind", func() {
const credstoreError = "credstore-error"

BeforeEach(func() {
fakeCredStore.PutReturns(nil, fmt.Errorf(credstoreError))
fakeCredStore.PutReturns(nil, errors.New(credstoreError))
})

It("should error", func() {
Expand All @@ -364,7 +365,7 @@ var _ = Describe("Bind", func() {
const credstorePermissionError = "credstore-error-permissions"

BeforeEach(func() {
fakeCredStore.AddPermissionReturns(nil, fmt.Errorf(credstorePermissionError))
fakeCredStore.AddPermissionReturns(nil, errors.New(credstorePermissionError))
})

It("should error", func() {
Expand Down
7 changes: 4 additions & 3 deletions brokerapi/broker/unbind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package broker_test

import (
"context"
"errors"
"fmt"

"code.cloudfoundry.org/lager/v3"
Expand Down Expand Up @@ -345,7 +346,7 @@ var _ = Describe("Unbind", func() {
const deleteError = "credential-delete-error"

BeforeEach(func() {
fakeStorage.DeleteServiceBindingCredentialsReturns(fmt.Errorf(deleteError))
fakeStorage.DeleteServiceBindingCredentialsReturns(errors.New(deleteError))
})

It("should error", func() {
Expand All @@ -359,7 +360,7 @@ var _ = Describe("Unbind", func() {
const deleteError = "bind-details-delete-error"

BeforeEach(func() {
fakeStorage.DeleteBindRequestDetailsReturns(fmt.Errorf(deleteError))
fakeStorage.DeleteBindRequestDetailsReturns(errors.New(deleteError))
})

It("should error", func() {
Expand All @@ -373,7 +374,7 @@ var _ = Describe("Unbind", func() {
const deleteError = "bind-provider-details-delete-error"

BeforeEach(func() {
fakeServiceProvider.DeleteBindingDataReturns(fmt.Errorf(deleteError))
fakeServiceProvider.DeleteBindingDataReturns(errors.New(deleteError))
})

It("should error", func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/tf/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (tfb *TfServiceDefinitionV1) resolveEnvVars() (map[string]string, error) {
for _, v := range tfb.RequiredEnvVars {
_ = viper.BindEnv(v, v)
if !viper.IsSet(v) {
return vars, fmt.Errorf(fmt.Sprintf("missing required env var %s", v))
return vars, fmt.Errorf("missing required env var %s", v)
}
vars[v] = viper.GetString(v)
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/providers/tf/deprovision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tf_test

import (
"context"
"errors"
"fmt"

"github.com/hashicorp/go-version"
Expand Down Expand Up @@ -99,7 +100,7 @@ var _ = Describe("Deprovision", func() {
})

It("fails, when unable to update the workspace HCL", func() {
fakeDeploymentManager.UpdateWorkspaceHCLReturns(fmt.Errorf(expectedError))
fakeDeploymentManager.UpdateWorkspaceHCLReturns(errors.New(expectedError))

provider := tf.NewTerraformProvider(
executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1.6.0"))},
Expand All @@ -116,7 +117,7 @@ var _ = Describe("Deprovision", func() {
})

It("fails, when unable to get the Terraform deployment", func() {
fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, fmt.Errorf(expectedError))
fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, errors.New(expectedError))

provider := tf.NewTerraformProvider(
executor.TFBinariesContext{},
Expand All @@ -134,7 +135,7 @@ var _ = Describe("Deprovision", func() {

It("fails, when unable to mark operation as started", func() {
fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil)
fakeDeploymentManager.MarkOperationStartedReturns(fmt.Errorf(expectedError))
fakeDeploymentManager.MarkOperationStartedReturns(errors.New(expectedError))

provider := tf.NewTerraformProvider(
executor.TFBinariesContext{},
Expand All @@ -154,7 +155,7 @@ var _ = Describe("Deprovision", func() {
fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil)
fakeDeploymentManager.MarkOperationStartedReturns(nil)
fakeInvokerBuilder.VersionedTerraformInvokerReturns(fakeDefaultInvoker)
fakeDefaultInvoker.DestroyReturns(fmt.Errorf(expectedError))
fakeDefaultInvoker.DestroyReturns(errors.New(expectedError))

provider := tf.NewTerraformProvider(
executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1.6.0"))},
Expand Down
11 changes: 6 additions & 5 deletions pkg/providers/tf/unbind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tf_test

import (
"context"
"errors"
"fmt"

"github.com/hashicorp/go-version"
Expand Down Expand Up @@ -108,7 +109,7 @@ var _ = Describe("Unbind", func() {
})

It("fails, when unable to update the workspace HCL", func() {
fakeDeploymentManager.UpdateWorkspaceHCLReturns(fmt.Errorf(expectedError))
fakeDeploymentManager.UpdateWorkspaceHCLReturns(errors.New(expectedError))

provider := tf.NewTerraformProvider(executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1"))}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager)

Expand All @@ -117,7 +118,7 @@ var _ = Describe("Unbind", func() {
})

It("fails, when unable to get the Terraform deployment", func() {
fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, fmt.Errorf(expectedError))
fakeDeploymentManager.GetTerraformDeploymentReturns(storage.TerraformDeployment{}, errors.New(expectedError))

provider := tf.NewTerraformProvider(executor.TFBinariesContext{}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager)

Expand All @@ -127,7 +128,7 @@ var _ = Describe("Unbind", func() {

It("fails, when unable to mark operation as started", func() {
fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil)
fakeDeploymentManager.MarkOperationStartedReturns(fmt.Errorf(expectedError))
fakeDeploymentManager.MarkOperationStartedReturns(errors.New(expectedError))

provider := tf.NewTerraformProvider(executor.TFBinariesContext{}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager)

Expand All @@ -139,8 +140,8 @@ var _ = Describe("Unbind", func() {
fakeDeploymentManager.GetTerraformDeploymentReturns(deployment, nil)
fakeDeploymentManager.MarkOperationStartedReturns(nil)
fakeInvokerBuilder.VersionedTerraformInvokerReturns(fakeDefaultInvoker)
fakeDefaultInvoker.DestroyReturns(fmt.Errorf(expectedError))
fakeDeploymentManager.OperationStatusReturns(true, "", fmt.Errorf(expectedError))
fakeDefaultInvoker.DestroyReturns(errors.New(expectedError))
fakeDeploymentManager.OperationStatusReturns(true, "", errors.New(expectedError))

provider := tf.NewTerraformProvider(executor.TFBinariesContext{DefaultTfVersion: version.Must(version.NewVersion("1"))}, fakeInvokerBuilder, fakeLogger, fakeServiceDefinition, fakeDeploymentManager)

Expand Down

0 comments on commit 502372a

Please sign in to comment.