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

Use remote cache instead of session storage #16114

Merged
merged 1 commit into from
Apr 8, 2019

Conversation

markelog
Copy link
Contributor

@markelog markelog commented Mar 20, 2019

What this PR does / why we need it:
Replaces session storage in auth_proxy middleware with remote cache

Which issue(s) this PR fixes:
Fixes #15161

Copy link
Contributor

@xlson xlson left a comment

Choose a reason for hiding this comment

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

Good job. This one is truly a hairy method, looking forward to when we have tests for it and can refactor safely.

pkg/middleware/auth_proxy.go Outdated Show resolved Hide resolved
pkg/middleware/auth_proxy.go Outdated Show resolved Hide resolved
pkg/middleware/auth_proxy.go Outdated Show resolved Hide resolved
@markelog markelog force-pushed the auth_proxy_remotecache branch 7 times, most recently from 2ec946c to 2ebf264 Compare March 25, 2019 10:36
@markelog markelog changed the title WIP: Use remote cache instead of session storage Use remote cache instead of session storage Mar 25, 2019
Copy link
Contributor Author

@markelog markelog left a comment

Choose a reason for hiding this comment

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

pkg/middleware/auth_proxy_test.go "unit" tests were removed since we are doing #16147 anyway and old stuff has to be rewrited there anyway.

Although, it seems middleware ("integration") tests already pretty extensive for auth_proxy module

devenv/docker/blocks/openldap/notes.md Show resolved Hide resolved
pkg/api/http_server.go Show resolved Hide resolved
pkg/infra/remotecache/remotecache.go Outdated Show resolved Hide resolved
pkg/middleware/auth_test.go Show resolved Hide resolved
@markelog markelog mentioned this pull request Mar 25, 2019
Copy link
Contributor

@xlson xlson left a comment

Choose a reason for hiding this comment

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

Good work. I did not have time to look at the tests properly, will try to take a look tonight or tomorrow when a I take a brea.

pkg/infra/remotecache/remotecache.go Outdated Show resolved Hide resolved
pkg/middleware/auth_proxy.go Outdated Show resolved Hide resolved
@@ -265,287 +267,192 @@ func TestMiddlewareContext(t *testing.T) {
})
})

middlewareScenario("When auth_proxy is enabled enabled and user exists", func(sc *scenarioContext) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't run the code so maybe I'm missing something here, but shouldn't this test still work after the changes? I see further tests that are related to auth_proxy without ldap, it seems like a bad idea to remove them. Let's sync up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me and @xlson had talk about it - the tests are changed a little: description, tree-like structure report and default values hoisted from test blocks, plus added couple more, that's the gist of it :).

It seems we are good here

@xlson
Copy link
Contributor

xlson commented Apr 8, 2019

Looks good. You can merge this now.

@markelog markelog merged commit 67cbc7d into grafana:master Apr 8, 2019
ryantxu added a commit to ryantxu/grafana that referenced this pull request Apr 9, 2019
* grafana/master: (27 commits)
  docs: fixes and update current version
  Docs: Updated changelog for v6.1.3
  Graph: fixed png rendering with legend to the right (grafana#16463)
  Fix: Disables auto open datasource picker on focus (grafana#16398)
  add some mock/stub guidelines to testing guideline (grafana#16466)
  Feat: Suggestion list in Explore is virtualized (grafana#16342)
  Docs: Updated roadmap issue to link to the pinned roadmap issues
  Graph: Fixed auto decimals in legend values (grafana#16455)
  Styling: Aligned heading (grafana#16456)
  add PromQL keyword for adhoc filter (grafana#16426)
  Singlestat: Use decimal override when manually specified (grafana#16451)
  Graph: follow-up graph decimals fix, grafana#16414 (grafana#16450)
  Chore: use remote cache instead of session storage (grafana#16114)
  Docs: Minor changelog tweak
  Docs: Updated changelog with v6.1.2 release issues
  datasource: fix disable query when using mixed datasource (grafana#16409)
  Graph: Fixed series legend color for hidden series (grafana#16438)
  Templating: Fixed loading React variable query editor (grafana#16439)
  Styles: Fixed left menu highlight (grafana#16431)
  Fix: remove test artefact (grafana#16411)
  ...
markelog added a commit to markelog/grafana that referenced this pull request Apr 22, 2019
* Added monkey dep for easy test stubbing

* Small refactoring of the settings module

* Update docs - remove references for the session storage

* Update config files (sample and default configs)

* Added tests for warning during the config load on defined storage cache

* Removed all references to session storage

* Removed macaron session dependency

Fixes grafana#16148
Ref grafana#16114
markelog added a commit that referenced this pull request Apr 22, 2019
* Chore: remove session storage references

* Small refactoring of the settings module

* Update docs - remove references for the session storage

* Update config files (sample and default configs)

* Add tests for warning during the config load on defined storage cache

* Remove all references to session storage

* Remove macaron session dependency

* Remove leftovers

* Fix: address review comments

* Fix: remove old deps

* Fix: add skipStaticRootValidation = true to tests

* Fix: improve the docs and warning message

As per discussion in here - https://github.com/grafana/grafana/pull/16445/files#r273026255

* Chore: make linter happy

Fixes #16148
Ref #16114
@ying-jeanne ying-jeanne added the pr/external This PR is from external contributor label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/external This PR is from external contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace session storage with distributed cache
4 participants