From 22628d1f7eedca2ce7fa6cd303fafdb6798dc93a Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Fri, 4 Nov 2022 09:37:25 -0700 Subject: [PATCH] Storage: fix failing test (set IsServiceAccount=true) (#58257) --- pkg/services/store/object/tests/common.go | 11 ++++++----- .../store/object/tests/server_integration_test.go | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/services/store/object/tests/common.go b/pkg/services/store/object/tests/common.go index 1b8afffa11a..29dfd27d752 100644 --- a/pkg/services/store/object/tests/common.go +++ b/pkg/services/store/object/tests/common.go @@ -42,11 +42,12 @@ func createServiceAccountAdminToken(t *testing.T, env *server.TestEnv) (string, }) return keyGen.ClientSecret, &user.SignedInUser{ - UserID: account.ID, - Email: account.Email, - Name: account.Name, - Login: account.Login, - OrgID: account.OrgID, + UserID: account.ID, + Email: account.Email, + Name: account.Name, + Login: account.Login, + OrgID: account.OrgID, + IsServiceAccount: account.IsServiceAccount, } } diff --git a/pkg/services/store/object/tests/server_integration_test.go b/pkg/services/store/object/tests/server_integration_test.go index bc430d0e0ee..24087ae9bcc 100644 --- a/pkg/services/store/object/tests/server_integration_test.go +++ b/pkg/services/store/object/tests/server_integration_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/services/store" "github.com/grafana/grafana/pkg/services/store/object" "github.com/grafana/grafana/pkg/util" "github.com/stretchr/testify/require" @@ -120,7 +121,7 @@ func TestIntegrationObjectServer(t *testing.T) { testCtx := createTestContext(t) ctx := metadata.AppendToOutgoingContext(testCtx.ctx, "authorization", fmt.Sprintf("Bearer %s", testCtx.authToken)) - fakeUser := fmt.Sprintf("user:%d:%s", testCtx.user.UserID, testCtx.user.Login) + fakeUser := store.GetUserIDString(testCtx.user) firstVersion := "1" kind := models.StandardKindJSONObj grn := &object.GRN{