Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the operation string in the response body for operations in progress #299

Merged
merged 2 commits into from
Jun 22, 2020

Conversation

royclarkson
Copy link
Member

This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284

@royclarkson royclarkson requested a review from spikymonkey June 19, 2020 22:16
@codecov
Copy link

codecov bot commented Jun 19, 2020

Codecov Report

Merging #299 into master will decrease coverage by 0.13%.
The diff coverage is 80.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #299      +/-   ##
============================================
- Coverage     91.41%   91.28%   -0.14%     
+ Complexity     1187     1186       -1     
============================================
  Files           145      146       +1     
  Lines          2890     2904      +14     
  Branches        294      294              
============================================
+ Hits           2642     2651       +9     
- Misses          187      192       +5     
  Partials         61       61              
Impacted Files Coverage Δ Complexity Δ
...ion/ServiceBrokerOperationInProgressException.java 45.45% <40.00%> (+2.59%) 3.00 <1.00> (+1.00)
...rviceBrokerCreateOperationInProgressException.java 50.00% <50.00%> (+7.14%) 1.00 <1.00> (-1.00) ⬆️
...rviceBrokerDeleteOperationInProgressException.java 50.00% <50.00%> (+7.14%) 1.00 <1.00> (-1.00) ⬆️
...rviceBrokerUpdateOperationInProgressException.java 50.00% <50.00%> (+7.14%) 1.00 <1.00> (-1.00) ⬆️
...broker/model/error/OperationInProgressMessage.java 93.33% <93.33%> (ø) 7.00 <7.00> (?)
...oker/controller/ServiceBrokerExceptionHandler.java 100.00% <100.00%> (ø) 29.00 <4.00> (+1.00)
...ervicebroker/model/AsyncServiceBrokerResponse.java 100.00% <100.00%> (ø) 15.00 <3.00> (+1.00)
.../cloud/servicebroker/model/error/ErrorMessage.java 84.21% <0.00%> (-5.27%) 10.00% <0.00%> (-1.00%)
...ork/cloud/servicebroker/model/catalog/Catalog.java 95.65% <0.00%> (-4.35%) 8.00% <0.00%> (-1.00%)
...oker/model/instance/GetServiceInstanceRequest.java 92.85% <0.00%> (-3.58%) 10.00% <0.00%> (-1.00%)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b69f874...35f05cc. Read the comment docs.

@royclarkson
Copy link
Member Author

@gberche-orange your review is appreciated as well. thanks.

Copy link
Contributor

@gberche-orange gberche-orange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @royclarkson for handling this issue!

Besides the 3 comments in this review, and slightly unrelated, I wonder what SC-OSB users should use in case of a successful async response with an operation field (still returning a 202 accepted, but not as a result of a concurrent on going call).

It might make sense to add a createServiceInstanceWithAsyncOperationAndHeadersSucceeds test case with

return Mono.just(CreateServiceInstanceResponse.builder()
						.dashboardUrl(dashboard)
						.operation(operation)
						.async(true)
						.instanceExisted(false)
						.build());

@royclarkson
Copy link
Member Author

Thanks @gberche-orange. If the CreateServiceInstanceResponse is set as async true, then we return a 202. Is that what you are referring to? I can certainly add another test as an example. Or are you suggesting something is broken with that use case?

@gberche-orange
Copy link
Contributor

gberche-orange commented Jun 22, 2020

If the CreateServiceInstanceResponse is set as async true, then we return a 202. Is that what you are referring to? I can certainly add another test as an example.

Yes, such a new test would be helpful as an example.

This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284
@royclarkson royclarkson force-pushed the 284-operation-in-progress branch from e3c6bfe to 35f05cc Compare June 22, 2020 21:00
@royclarkson royclarkson removed the request for review from spikymonkey June 22, 2020 21:04
@royclarkson royclarkson merged commit 9bdee41 into master Jun 22, 2020
@royclarkson royclarkson deleted the 284-operation-in-progress branch June 22, 2020 21:06
@royclarkson
Copy link
Member Author

@gberche-orange I added the requested test here. Thanks for the recommendation. 50a31c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ServiceBrokerCreateOperationInProgressException should accept and return operation state
2 participants