-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update_diagrams
- Loading branch information
Showing
6 changed files
with
280 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,81 @@ func TestDeprovisioningWithExistingBindings(t *testing.T) { | |
suite.AssertBindingRemoval(iid, bindingID2) | ||
} | ||
|
||
func TestFailedProvisioning(t *testing.T) { | ||
// given | ||
cfg := fixConfig() | ||
// Disable EDP to have all steps successfully executed | ||
cfg.EDP.Disabled = true | ||
suite := NewBrokerSuiteTestWithConfig(t, cfg) | ||
defer suite.TearDown() | ||
iid := uuid.New().String() | ||
bindingID1 := uuid.New().String() | ||
|
||
response := suite.CallAPI(http.MethodPut, fmt.Sprintf("oauth/v2/service_instances/%s?accepts_incomplete=true", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"subaccount_id": "sub-id", | ||
"user_id": "[email protected]" | ||
}, | ||
"parameters": { | ||
"name": "testing-cluster", | ||
"region": "eu-central-1" | ||
} | ||
}`) | ||
opID := suite.DecodeOperationID(response) | ||
suite.failProvisioningByOperationID(opID) | ||
|
||
// when we create binding | ||
response = suite.CallAPI(http.MethodPut, fmt.Sprintf("oauth/v2/service_instances/%s/service_bindings/%s", iid, bindingID1), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15" | ||
}`) | ||
|
||
// then expect 400 as agreed in the contract | ||
require.Equal(t, http.StatusBadRequest, response.StatusCode) | ||
} | ||
|
||
func TestProvisioningInProgress(t *testing.T) { | ||
// given | ||
cfg := fixConfig() | ||
// Disable EDP to have all steps successfully executed | ||
cfg.EDP.Disabled = true | ||
suite := NewBrokerSuiteTestWithConfig(t, cfg) | ||
defer suite.TearDown() | ||
iid := uuid.New().String() | ||
bindingID1 := uuid.New().String() | ||
|
||
response := suite.CallAPI(http.MethodPut, fmt.Sprintf("oauth/v2/service_instances/%s?accepts_incomplete=true", iid), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15", | ||
"context": { | ||
"globalaccount_id": "g-account-id", | ||
"subaccount_id": "sub-id", | ||
"user_id": "[email protected]" | ||
}, | ||
"parameters": { | ||
"name": "testing-cluster", | ||
"region": "eu-central-1" | ||
} | ||
}`) | ||
opID := suite.DecodeOperationID(response) | ||
suite.WaitForProvisioningState(opID, domain.InProgress) | ||
// when we create binding | ||
response = suite.CallAPI(http.MethodPut, fmt.Sprintf("oauth/v2/service_instances/%s/service_bindings/%s", iid, bindingID1), | ||
`{ | ||
"service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", | ||
"plan_id": "361c511f-f939-4621-b228-d0fb79a1fe15" | ||
}`) | ||
|
||
// then expect 400 as agreed in the contract | ||
require.Equal(t, http.StatusBadRequest, response.StatusCode) | ||
} | ||
|
||
func TestRemoveBindingsFromSuspended(t *testing.T) { | ||
// given | ||
cfg := fixConfig() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.