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

fix(gcb): Return mutable lists from methods annoated with PostFilter #673

Merged
merged 4 commits into from
Mar 20, 2020
Merged

fix(gcb): Return mutable lists from methods annoated with PostFilter #673

merged 4 commits into from
Mar 20, 2020

Commits on Mar 20, 2020

  1. 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.
    ezimanyi committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    2014f6c View commit details
    Browse the repository at this point in the history
  2. 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.
    ezimanyi committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    05efb97 View commit details
    Browse the repository at this point in the history
  3. 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.
    ezimanyi committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    fbe8775 View commit details
    Browse the repository at this point in the history
  4. 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.
    ezimanyi committed Mar 20, 2020
    Configuration menu
    Copy the full SHA
    7285f7c View commit details
    Browse the repository at this point in the history