Skip to content

Commit

Permalink
PMM-7 Fix for service accounts tests stability. (#2976)
Browse files Browse the repository at this point in the history
* PMM-7 Test.

* trigger

* trigger

* trigger

* trigger

* trigger

* trigger

* trigger

* trigger

* trigger

* PMM-7 test.

* trigger

* trigger

* trigger

* PMM-7 Test if fails are due to locked accounts.

* PMM-7 Test not in parallels.

* trigger

* trigger

* trigger

* PMM-7 Comment about locks.

* trigger
  • Loading branch information
JiriCtvrtka authored Apr 30, 2024
1 parent dc10c50 commit 3258363
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions managed/services/grafana/auth_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ func TestServerClientConnection(t *testing.T) {
assert.Nil(t, authError)
})

// Beware: Five or more wrong tries will lock user with error message: "Invalid user or password".
t.Run("Basic auth - fail", func(t *testing.T) {
t.Parallel()

Expand Down
10 changes: 0 additions & 10 deletions managed/services/grafana/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ func TestClient(t *testing.T) {

t.Run("getRole", func(t *testing.T) {
t.Run("GrafanaAdmin", func(t *testing.T) {
t.Parallel()

u, err := c.getAuthUser(ctx, authHeaders)
role := u.role
assert.NoError(t, err)
Expand All @@ -51,8 +49,6 @@ func TestClient(t *testing.T) {
})

t.Run("NoAnonymousAccess", func(t *testing.T) {
t.Parallel()

// See [auth.anonymous] in grafana.ini.
// Even if anonymous access is enabled, returned role is None, not org_role.

Expand Down Expand Up @@ -101,8 +97,6 @@ func TestClient(t *testing.T) {
role := role

t.Run(fmt.Sprintf("Basic auth %s", role.String()), func(t *testing.T) {
t.Parallel()

login := fmt.Sprintf("basic-%s-%d", role, time.Now().Nanosecond())
userID, err := c.testCreateUser(ctx, login, role, authHeaders)
require.NoError(t, err)
Expand All @@ -127,8 +121,6 @@ func TestClient(t *testing.T) {
})

t.Run(fmt.Sprintf("API Key auth %s", role.String()), func(t *testing.T) {
t.Parallel()

login := fmt.Sprintf("api-%s-%d", role, time.Now().Nanosecond())
apiKeyID, apiKey, err := c.createAPIKey(ctx, login, role, authHeaders)
require.NoError(t, err)
Expand All @@ -152,8 +144,6 @@ func TestClient(t *testing.T) {
})

t.Run(fmt.Sprintf("Service token auth %s", role.String()), func(t *testing.T) {
t.Parallel()

nodeName := fmt.Sprintf("test-node-%s", role)
serviceAccountID, err := c.createServiceAccount(ctx, role, nodeName, true, authHeaders)
require.NoError(t, err)
Expand Down

0 comments on commit 3258363

Please sign in to comment.