-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gcb): Return mutable lists from methods annoated with PostFilter (#…
…673) * test(gcb): Update tests to run postFilter logic The GCB integration tests currently don't run the postFilter logic that is added as an annotation on controller methods. I believe this is because we've been to selective in exactly the beans that should be present in the test, and are not pulling in the required Spring Security beans. In order to fix this, add the same @componentscan that we have on Main.class to the test so it pulls in the same beans. (We can then also remove the specific controller bean we'd been pulling in, but will leave all the configuration beans in place.) This causes the listAccountTest to fail because the listAccounts function is currently broken; the next commit will fix the function and the test. * fix(gcb): Return mutable lists from methods annoated with PostFilter Controller methods annotated with PostFilter cannot return immutable lists because the filtering is done in-place on the returned array; update all controller methods in GoogleCloudBuildController to return a mutable list. As we would like the lower levels of the stack to deal in immutable collections as much as possible, just create a mutable collection at the last step before returning from the controller method. * fix(gcb): Dirty application context for GCB tests As we are now fully loading the application context as part of the GCB tests, we should mark the test with DirtiesContext so that it does not interfere with other tests. * fix(gcb): Use mock HystrixSpectatorPublisher bean The tests were failing because we can only ever create a single HystrixSpectatorPublisher bean, due to the fact that it mutates a static field on the HystrixPlugins class, which causes a failure if we try to mutate it again. This was addressed in MainTest by clearing the Hystrix class after every test, but let's just inject a mock bean instead to avoid mutating the static class in the first place.
- Loading branch information
Showing
3 changed files
with
22 additions
and
26 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
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