• Dylan Griffith's avatar
    Fix problem with Elasticsearch timed_out check for index_exists? · 4ae05e3b
    Dylan Griffith authored
    We previously implemented the `timed_out` count in
    https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53955/diffs
    but it had to be reverted due to it not being able to handle an empty
    response body
    https://gitlab.com/gitlab-com/gl-infra/production/-/issues/3623
    https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54053 .
    
    It was very easy to reproduce the problem observed in that by simply:
    
    1. Visit `Admin > Settings > Preferences`
    2. Update the email additional attributes
    3. Save
    
    This problem will actually happen when updating anything in the admin
    UI.
    
    This was quite surprising as we have tonnes of tests that go down this
    code path throughout GitLab. As such it was very strange to not see a
    single test failure outside of these QA tests that ran against staging.
    It turns out the reason is that this code only runs when
    `SafeRequestStore` is active otherwise the interceptor logic is skipped.
    It turns out that none of our tests that execute these code paths had
    the `SafeRequestStore` active. In an effort to reduce the risk of this
    happening I've actived the `request_store` in the `helper_spec.rb` which
    covers many of the Elasticsearch queries we execute which would have
    actually caught this problem
    
    Additionally I've updated the unit test with this new specific case and
    another slightly similar case of error responses just to be safe.
    4ae05e3b
301146-log-timeouts-from-elasticsearch.yml 117 Bytes