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

PMM-13315 Service account max length. #3221

Open
wants to merge 12 commits into
base: v3
Choose a base branch
from

Conversation

JiriCtvrtka
Copy link
Contributor

@JiriCtvrtka JiriCtvrtka commented Oct 1, 2024

@JiriCtvrtka JiriCtvrtka changed the title Pmm 13315 service account max length PMM-13315 Service account max length. Oct 1, 2024
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 44.63%. Comparing base (5e6fc13) to head (b14fef8).

Files with missing lines Patch % Lines
managed/services/grafana/client.go 80.00% 1 Missing and 1 partial ⚠️
managed/utils/strings/generate.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #3221      +/-   ##
==========================================
+ Coverage   44.59%   44.63%   +0.04%     
==========================================
  Files         357      358       +1     
  Lines       35719    35729      +10     
==========================================
+ Hits        15929    15949      +20     
+ Misses      18167    18155      -12     
- Partials     1623     1625       +2     
Flag Coverage Δ
managed 46.71% <75.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JiriCtvrtka JiriCtvrtka marked this pull request as ready for review October 3, 2024 11:18
@JiriCtvrtka JiriCtvrtka requested a review from a team as a code owner October 3, 2024 11:18
@JiriCtvrtka JiriCtvrtka requested review from BupycHuk, idoqo and ademidoff and removed request for a team October 3, 2024 11:18
@@ -617,3 +620,11 @@ func deleteServiceToken(t *testing.T, serviceAccountID, serviceTokenID int) {

require.Equalf(t, http.StatusOK, resp.StatusCode, "failed to delete service token, status code: %d, response: %s", resp.StatusCode, b)
}

func sanitizeSAName(name string) string {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can't keep and then import this method from github.com/percona/pmm/managed/utils/strings package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is to avoid dependencies between managed and API tests. To keep them separate. We doing this in more places. It was discussed with Nurlan.

// on orgID number. Let's reserve 10 chars. It will cover almost one million orgIDs.
// Sanitizing, ensure its length by hashing postfix when length is exceeded.
// MD5 is used because it has fixed length 32 chars.
func sanitizeSAName(name string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't that a utility method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if it belongs to utils when its related only to service accounts, which are part of Grafana.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants