Skip to content

Commit

Permalink
Incorporate DB in Binding Selection E2E Test
Browse files Browse the repository at this point in the history
  • Loading branch information
ralikio committed Oct 10, 2024
1 parent 62d98dc commit 1987267
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/broker/bind_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,17 @@ func TestCreateBindingEndpoint(t *testing.T) {
// given
instanceIDFirst := "1"
firstInstanceFirstBindingID, firstInstancefirstBinding := createBindingForInstance(instanceIDFirst, httpServer, t)
firstInstanceFirstBindingDB, err := db.Bindings().Get(instanceIDFirst, firstInstanceFirstBindingID)
assert.NoError(t, err)

instanceIDSecond := "2"
secondInstanceBindingID, secondInstanceFirstBinding := createBindingForInstance(instanceIDSecond, httpServer, t)
secondInstanceFirstBindingDB, err := db.Bindings().Get(instanceIDSecond, secondInstanceBindingID)
assert.NoError(t, err)

firstInstanceSecondBindingID, firstInstanceSecondBinding := createBindingForInstance(instanceIDFirst, httpServer, t)
firstInstanceSecondBindingDB, err := db.Bindings().Get(instanceIDFirst, firstInstanceSecondBindingID)
assert.NoError(t, err)

// when - first binding to the first instance
path := fmt.Sprintf("v2/service_instances/%s/service_bindings/%s?accepts_incomplete=false", instanceIDFirst, firstInstanceFirstBindingID)
Expand All @@ -345,6 +351,7 @@ func TestCreateBindingEndpoint(t *testing.T) {
assert.Equal(t, http.StatusOK, response.StatusCode)
binding := unmarshal(t, response)
assert.Equal(t, firstInstancefirstBinding, binding)
assert.Equal(t, firstInstanceFirstBindingDB.Kubeconfig, binding.Credentials.(map[string]interface{})["kubeconfig"])
assertClusterAccess(t, response, "secret-to-check-first", binding)

// when - binding to the second instance
Expand All @@ -356,6 +363,7 @@ func TestCreateBindingEndpoint(t *testing.T) {
assert.Equal(t, http.StatusOK, response.StatusCode)
binding = unmarshal(t, response)
assert.Equal(t, secondInstanceFirstBinding, binding)
assert.Equal(t, secondInstanceFirstBindingDB.Kubeconfig, binding.Credentials.(map[string]interface{})["kubeconfig"])
assertClusterAccess(t, response, "secret-to-check-second", binding)

// when - second binding to the first instance
Expand All @@ -367,6 +375,7 @@ func TestCreateBindingEndpoint(t *testing.T) {
assert.Equal(t, http.StatusOK, response.StatusCode)
binding = unmarshal(t, response)
assert.Equal(t, firstInstanceSecondBinding, binding)
assert.Equal(t, firstInstanceSecondBindingDB.Kubeconfig, binding.Credentials.(map[string]interface{})["kubeconfig"])
assertClusterAccess(t, response, "secret-to-check-first", binding)
})
}
Expand Down

0 comments on commit 1987267

Please sign in to comment.