Skip to content

Commit

Permalink
Merge pull request #631 from /issues/549
Browse files Browse the repository at this point in the history
Fix cross test contamination in controller units
  • Loading branch information
davewalter authored Feb 8, 2022
2 parents eedc719 + acf917f commit e43f503
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ issues:
- path: _test\.go
linters:
- dupl
# We are getting false positives comparing the cfserviceinstance and cfservicebinding reconcile loops. This may
# become unnecessary later if the implementation diverges more.
- path: service\w+_controller\.go
linters:
- dupl
3 changes: 3 additions & 0 deletions api/tests/e2e/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ var _ = Describe("Package", func() {

spaceGUID = createSpace(generateGUID("space1"), orgGUID)
appGUID = createApp(spaceGUID, generateGUID("app"))

result = packageResource{}
resultErr = cfErrs{}
})

AfterEach(func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ var _ = Describe("CFServiceBinding.Reconcile", func() {
)

BeforeEach(func() {
getCFServiceBindingError = nil
getCFServiceBindingSecretError = nil
updateCFServiceBindingStatusError = nil

fakeClient = new(fake.Client)
fakeStatusWriter = new(fake.StatusWriter)
fakeClient.StatusReturns(fakeStatusWriter)
Expand Down Expand Up @@ -154,7 +158,7 @@ var _ = Describe("CFServiceBinding.Reconcile", func() {
})
When("The API errors setting status on the CFServiceBinding", func() {
BeforeEach(func() {
updateCFServiceBindingStatusError = errors.New("some random error")
updateCFServiceBindingStatusError = errors.New("another random error")
})

It("errors", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ var _ = Describe("CFServiceInstance.Reconcile", func() {
)

BeforeEach(func() {
getCFServiceInstanceError = nil
getCFServiceInstanceSecretError = nil
updateCFServiceInstanceStatusError = nil

fakeClient = new(fake.Client)
fakeStatusWriter = new(fake.StatusWriter)
fakeClient.StatusReturns(fakeStatusWriter)
Expand Down

0 comments on commit e43f503

Please sign in to comment.