Build: #1087 was successful
Job: Default Job was successful
Code commits
openboxes-develop
-
Evan <evanwaterman@hotmail.com> 4b6ab285dc0414c5b872fa0089ec8c916812b160
Fix flaky API specs racing transactional controller commits
-
Christian Allen <christian@christianallen.com> c241d5afa6d82b13999dce17d7adb644bb0680b7 m
Register the response-close filter at the highest precedence
The filter only has to run before Grails' grailsWebRequestFilter
(HIGHEST_PRECEDENCE + 30), which builds the GrailsWebRequest from the
response it receives. Ordering it relative to the Sentry filter was
arbitrary; registering it at the highest precedence keeps it in front
of any filter added later.- src/integration-test/groovy/org/pih/warehouse/common/base/IntegrationSpecConfig.groovy (version c241d5afa6d82b13999dce17d7adb644bb0680b7)
-
Christian Allen <christian@christianallen.com> e228cdd5f7f2079b11560cb2972f51edfbaa2126 m
Address review: explain filter ordering, packaging and close semantics
Comment-only: say why the filter is ordered right after the Sentry filter,
that the class is neither component-scanned nor packaged, who calls close()
on the writer and the stream and who closes the container's own stream, and
walk through the spec step by step.- src/integration-test/groovy/org/pih/warehouse/api/spec/web/DeferResponseCloseFilterSpec.groovy (version e228cdd5f7f2079b11560cb2972f51edfbaa2126)
- src/integration-test/groovy/org/pih/warehouse/common/base/IntegrationSpecConfig.groovy (version e228cdd5f7f2079b11560cb2972f51edfbaa2126)
- src/integration-test/groovy/org/pih/warehouse/common/web/DeferResponseCloseFilter.groovy (version e228cdd5f7f2079b11560cb2972f51edfbaa2126)
-
Christian Allen <christian@christianallen.com> 513a62c97a6fc9441e702cbbfaa8d195a9c8ec4b m
Fix flaky API specs racing transactional controller commits
The Grails JSON converter closes the response writer at the end of render(),
which makes the container finish the response while a class-level
@Transactional controller action has not yet committed. The API specs fire
their next request as soon as the previous response is complete, so that
request can reach the database before the commit. This is the source of the
intermittent "foreign key constraint fails" and "unsaved transient instance"
failures in run-backend-tests.
Add DeferResponseCloseFilter to the integration test source set and register
it for every integration spec from IntegrationSpecConfig. It turns close() on
the response writer and output stream into a flush (discarding further
output, as the container does after a real close) so that a response finished
by closing the writer or stream is completed when the request finishes, after
the action has returned and its transaction has completed. No production
sources change and the filter is not packaged into the application.
Add an integration spec that blocks a category save's commit from Hibernate's
post-insert event and asserts the client is still waiting.- src/integration-test/groovy/org/pih/warehouse/api/spec/web/DeferResponseCloseFilterSpec.groovy (version 513a62c97a6fc9441e702cbbfaa8d195a9c8ec4b)
- src/integration-test/groovy/org/pih/warehouse/common/base/IntegrationSpecConfig.groovy (version 513a62c97a6fc9441e702cbbfaa8d195a9c8ec4b)
- src/integration-test/groovy/org/pih/warehouse/common/web/DeferResponseCloseFilter.groovy (version 513a62c97a6fc9441e702cbbfaa8d195a9c8ec4b)