-
Notifications
You must be signed in to change notification settings - Fork 69
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
chore: Add option to hide tokens from ring statuspage #633
Conversation
t.Run("displays expected partition info", func(t *testing.T) { | ||
recorder := httptest.NewRecorder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by-fix: In a test of this form, each case needs its own isolated recorder. The recorder does not replace its contents when invoked multiple times, but rather appends the request bodies as the cases proceed.
These tests all still pass, but without this they have less coverage than they appear to.
// ShowTokens indicates whether the Show Tokens button is clicked. | ||
ShowTokens bool `json:"-"` | ||
// DisableTokens hides the concept of tokens entirely in the page, across all elements. | ||
DisableTokens bool `json:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I switched the name to DisableTokens
.
I still feel HideTokens
is the better name for the public APIs/config options, but within this file i felt the name HideTokens
conflicts with the option ShowTokens
and hurts readability.
}, `\s*`))), recorder.Body.String()) | ||
|
||
assert.Regexp(t, regexp.MustCompile(fmt.Sprintf("(?m)%s", strings.Join([]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skipped asserting a couple columns here, namely the ones containing heartbeat timestamps and such.
Asserting on these full-precision times felt like a very high vector for test intermittency - plus, it's not really the focus of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does:
This PR is the inverse of #631.
There are contexts in which the instance ring is used, but tokens are ignored. Such contexts can now configure
HideTokens
on the ring or lifecycler in order to hide the concept of tokens completely from the ring status page.Here is what the page looks like with the toggle left at default (no visible changes):
Hiding the tokens changes the page to look like:
Similarly, no "Show Tokens" button at the bottom:
Which issue(s) this PR fixes:
Contrib https://github.com/grafana/mimir-squad/issues/2350
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]