Skip to content

Commit

Permalink
Fix a binding controller flake
Browse files Browse the repository at this point in the history
Flake: https://ci.korifi.cf-app.com/teams/main/pipelines/main/jobs/run-tests-periodic/builds/22068

According to failure logs, the service binding is being reconciled
multiple times before the binding gets into its ready state.

This means that if we stub the broker client to return a sync response
on invocation 3 only, it is quite probable that the fake's sync response
is not properly processed and subsequent reconciles still see that the
operation is ongoing.

Therefore, this change alters stubs the broker client to return a sync
response (i.e. override the default async one) when it returns a
succeeded operation
  • Loading branch information
danail-branekov committed Feb 14, 2025
1 parent 9517aec commit fea6dd7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions controllers/controllers/services/bindings/controller_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bindings_test

import (
"context"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -963,15 +964,17 @@ var _ = Describe("CFServiceBinding", func() {

When("last operation has succeeded", func() {
BeforeEach(func() {
brokerClient.GetServiceBindingLastOperationReturns(osbapi.LastOperationResponse{
State: "succeeded",
}, nil)
brokerClient.GetServiceBindingLastOperationStub = func(context.Context, osbapi.GetBindingLastOperationRequest) (osbapi.LastOperationResponse, error) {
brokerClient.BindReturns(osbapi.BindResponse{
Credentials: map[string]any{
"foo": "bar",
},
}, nil)

brokerClient.BindReturnsOnCall(3, osbapi.BindResponse{
Credentials: map[string]any{
"foo": "bar",
},
}, nil)
return osbapi.LastOperationResponse{
State: "succeeded",
}, nil
}
})

It("sets the ready condition to true", func() {
Expand Down

0 comments on commit fea6dd7

Please sign in to comment.