diff --git a/backend.go b/backend.go index f330d53..b85d7bc 100644 --- a/backend.go +++ b/backend.go @@ -149,7 +149,7 @@ func (b *Backend) getClient(ctx context.Context, s logical.Storage, name string) if c, ok := b.clients.Load(cmp.Or(name, DefaultConfigName)); ok { client = c.(Client) } - if client != nil && client.Valid() { + if client != nil && client.Valid(ctx) { b.Logger().Debug("Returning existing gitlab client") return client, nil } diff --git a/defs.go b/defs.go index b9f4898..1fce59c 100644 --- a/defs.go +++ b/defs.go @@ -27,9 +27,22 @@ const ( DefaultAutoRotateBeforeMaxTTL = 730 * time.Hour ctxKeyHttpClient = contextKey("vpsg-ctx-key-http-client") ctxKeyGitlabClient = contextKey("vpsg-ctx-key-gitlab-client") + ctxKeyTimeNow = contextKey("vpsg-ctx-key-time-now") DefaultConfigName = "default" ) +func WithStaticTime(ctx context.Context, t time.Time) context.Context { + return context.WithValue(ctx, ctxKeyTimeNow, t) +} + +func TimeFromContext(ctx context.Context) time.Time { + t, ok := ctx.Value(ctxKeyTimeNow).(time.Time) + if !ok { + return time.Now() + } + return t +} + func HttpClientNewContext(ctx context.Context, httpClient *http.Client) context.Context { return context.WithValue(ctx, ctxKeyHttpClient, httpClient) } diff --git a/gitlab_client.go b/gitlab_client.go index 41b927d..5a1c3de 100644 --- a/gitlab_client.go +++ b/gitlab_client.go @@ -1,6 +1,7 @@ package gitlab import ( + "context" "errors" "fmt" "io" @@ -20,22 +21,22 @@ var ( ) type Client interface { - GitlabClient() *g.Client - Valid() bool - CurrentTokenInfo() (*EntryToken, error) - RotateCurrentToken() (newToken *EntryToken, oldToken *EntryToken, err error) - CreatePersonalAccessToken(username string, userId int, name string, expiresAt time.Time, scopes []string) (*EntryToken, error) - CreateGroupAccessToken(groupId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (*EntryToken, error) - CreateProjectAccessToken(projectId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (*EntryToken, error) - RevokePersonalAccessToken(tokenId int) error - RevokeProjectAccessToken(tokenId int, projectId string) error - RevokeGroupAccessToken(tokenId int, groupId string) error - GetUserIdByUsername(username string) (int, error) - GetGroupIdByPath(path string) (int, error) - CreateGroupServiceAccountAccessToken(group string, groupId string, userId int, name string, expiresAt time.Time, scopes []string) (*EntryToken, error) - CreateUserServiceAccountAccessToken(username string, userId int, name string, expiresAt time.Time, scopes []string) (*EntryToken, error) - RevokeUserServiceAccountAccessToken(token string) error - RevokeGroupServiceAccountAccessToken(token string) error + GitlabClient(ctx context.Context) *g.Client + Valid(ctx context.Context) bool + CurrentTokenInfo(ctx context.Context) (*EntryToken, error) + RotateCurrentToken(ctx context.Context) (newToken *EntryToken, oldToken *EntryToken, err error) + CreatePersonalAccessToken(ctx context.Context, username string, userId int, name string, expiresAt time.Time, scopes []string) (*EntryToken, error) + CreateGroupAccessToken(ctx context.Context, groupId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (*EntryToken, error) + CreateProjectAccessToken(ctx context.Context, projectId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (*EntryToken, error) + RevokePersonalAccessToken(ctx context.Context, tokenId int) error + RevokeProjectAccessToken(ctx context.Context, tokenId int, projectId string) error + RevokeGroupAccessToken(ctx context.Context, tokenId int, groupId string) error + GetUserIdByUsername(ctx context.Context, username string) (int, error) + GetGroupIdByPath(ctx context.Context, path string) (int, error) + CreateGroupServiceAccountAccessToken(ctx context.Context, group string, groupId string, userId int, name string, expiresAt time.Time, scopes []string) (*EntryToken, error) + CreateUserServiceAccountAccessToken(ctx context.Context, username string, userId int, name string, expiresAt time.Time, scopes []string) (*EntryToken, error) + RevokeUserServiceAccountAccessToken(ctx context.Context, token string) error + RevokeGroupServiceAccountAccessToken(ctx context.Context, token string) error } type gitlabClient struct { @@ -45,7 +46,7 @@ type gitlabClient struct { logger hclog.Logger } -func (gc *gitlabClient) GetGroupIdByPath(path string) (groupId int, err error) { +func (gc *gitlabClient) GetGroupIdByPath(ctx context.Context, path string) (groupId int, err error) { defer func() { gc.logger.Debug("Get group id by path", "path", path, "groupId", groupId, "error", err) }() @@ -66,11 +67,11 @@ func (gc *gitlabClient) GetGroupIdByPath(path string) (groupId int, err error) { } -func (gc *gitlabClient) GitlabClient() *g.Client { +func (gc *gitlabClient) GitlabClient(ctx context.Context) *g.Client { return gc.client } -func (gc *gitlabClient) CreateGroupServiceAccountAccessToken(path string, groupId string, userId int, name string, expiresAt time.Time, scopes []string) (et *EntryToken, err error) { +func (gc *gitlabClient) CreateGroupServiceAccountAccessToken(ctx context.Context, path string, groupId string, userId int, name string, expiresAt time.Time, scopes []string) (et *EntryToken, err error) { var at *g.PersonalAccessToken defer func() { gc.logger.Debug("Created group service access token", "pat", at, "et", et, "path", path, "groupId", groupId, "userId", userId, "name", name, "expiresAt", expiresAt, "scopes", scopes, "error", err) @@ -98,18 +99,18 @@ func (gc *gitlabClient) CreateGroupServiceAccountAccessToken(path string, groupI return et, err } -func (gc *gitlabClient) CreateUserServiceAccountAccessToken(username string, userId int, name string, expiresAt time.Time, scopes []string) (et *EntryToken, err error) { +func (gc *gitlabClient) CreateUserServiceAccountAccessToken(ctx context.Context, username string, userId int, name string, expiresAt time.Time, scopes []string) (et *EntryToken, err error) { defer func() { gc.logger.Debug("Created user service access token", "et", et, "username", username, "userId", userId, "name", name, "expiresAt", expiresAt, "scopes", scopes, "error", err) }() - et, err = gc.CreatePersonalAccessToken(username, userId, name, expiresAt, scopes) + et, err = gc.CreatePersonalAccessToken(ctx, username, userId, name, expiresAt, scopes) if err == nil && et != nil { et.TokenType = TokenTypeUserServiceAccount } return et, err } -func (gc *gitlabClient) RevokeUserServiceAccountAccessToken(token string) (err error) { +func (gc *gitlabClient) RevokeUserServiceAccountAccessToken(ctx context.Context, token string) (err error) { defer func() { gc.logger.Debug("Revoke user service account token", "token", token, "error", err) }() if token == "" { err = fmt.Errorf("%w: empty token", ErrNilValue) @@ -127,7 +128,7 @@ func (gc *gitlabClient) RevokeUserServiceAccountAccessToken(token string) (err e return err } -func (gc *gitlabClient) RevokeGroupServiceAccountAccessToken(token string) (err error) { +func (gc *gitlabClient) RevokeGroupServiceAccountAccessToken(ctx context.Context, token string) (err error) { defer func() { gc.logger.Debug("Revoke group service account token", "token", token, "error", err) }() if token == "" { err = fmt.Errorf("%w: empty token", ErrNilValue) @@ -145,7 +146,7 @@ func (gc *gitlabClient) RevokeGroupServiceAccountAccessToken(token string) (err return err } -func (gc *gitlabClient) CurrentTokenInfo() (et *EntryToken, err error) { +func (gc *gitlabClient) CurrentTokenInfo(ctx context.Context) (et *EntryToken, err error) { var pat *g.PersonalAccessToken defer func() { gc.logger.Debug("Current token info", "token", et, "error", err) }() pat, _, err = gc.client.PersonalAccessTokens.GetSinglePersonalAccessToken() @@ -168,13 +169,13 @@ func (gc *gitlabClient) CurrentTokenInfo() (et *EntryToken, err error) { return et, nil } -func (gc *gitlabClient) RotateCurrentToken() (token *EntryToken, currentEntryToken *EntryToken, err error) { +func (gc *gitlabClient) RotateCurrentToken(ctx context.Context) (token *EntryToken, currentEntryToken *EntryToken, err error) { var expiresAt time.Time defer func() { gc.logger.Debug("Rotate current token", "token", token, "currentEntryToken", currentEntryToken, "expiresAt", expiresAt, "error", err) }() - currentEntryToken, err = gc.CurrentTokenInfo() + currentEntryToken, err = gc.CurrentTokenInfo(ctx) if err != nil { return nil, nil, err } @@ -187,7 +188,7 @@ func (gc *gitlabClient) RotateCurrentToken() (token *EntryToken, currentEntryTok var pat *g.PersonalAccessToken var durationTTL = currentEntryToken.ExpiresAt.Sub(*currentEntryToken.CreatedAt) - _, expiresAt, _ = calculateGitlabTTL(durationTTL, time.Now()) + _, expiresAt, _ = calculateGitlabTTL(durationTTL, TimeFromContext(ctx)) pat, _, err = gc.client.PersonalAccessTokens.RotatePersonalAccessToken( currentEntryToken.TokenID, &g.RotatePersonalAccessTokenOptions{ExpiresAt: (*g.ISOTime)(&expiresAt)}, @@ -225,7 +226,7 @@ func (gc *gitlabClient) RotateCurrentToken() (token *EntryToken, currentEntryTok return token, currentEntryToken, err } -func (gc *gitlabClient) GetUserIdByUsername(username string) (userId int, err error) { +func (gc *gitlabClient) GetUserIdByUsername(ctx context.Context, username string) (userId int, err error) { defer func() { gc.logger.Debug("Get user id by username", "username", username, "userId", userId, "error", err) }() @@ -245,7 +246,7 @@ func (gc *gitlabClient) GetUserIdByUsername(username string) (userId int, err er return userId, nil } -func (gc *gitlabClient) CreatePersonalAccessToken(username string, userId int, name string, expiresAt time.Time, scopes []string) (et *EntryToken, err error) { +func (gc *gitlabClient) CreatePersonalAccessToken(ctx context.Context, username string, userId int, name string, expiresAt time.Time, scopes []string) (et *EntryToken, err error) { var at *g.PersonalAccessToken defer func() { gc.logger.Debug("Create personal access token", "pat", at, "et", et, "username", username, "userId", userId, "name", name, "expiresAt", expiresAt, "scopes", scopes, "error", err) @@ -274,7 +275,7 @@ func (gc *gitlabClient) CreatePersonalAccessToken(username string, userId int, n return et, nil } -func (gc *gitlabClient) CreateGroupAccessToken(groupId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (et *EntryToken, err error) { +func (gc *gitlabClient) CreateGroupAccessToken(ctx context.Context, groupId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (et *EntryToken, err error) { var at *g.GroupAccessToken defer func() { gc.logger.Debug("Create group access token", "gat", at, "et", et, "groupId", groupId, "name", name, "expiresAt", expiresAt, "scopes", scopes, "accessLevel", accessLevel, "error", err) @@ -306,7 +307,7 @@ func (gc *gitlabClient) CreateGroupAccessToken(groupId string, name string, expi return et, nil } -func (gc *gitlabClient) CreateProjectAccessToken(projectId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (*EntryToken, error) { +func (gc *gitlabClient) CreateProjectAccessToken(ctx context.Context, projectId string, name string, expiresAt time.Time, scopes []string, accessLevel AccessLevel) (*EntryToken, error) { var al = new(g.AccessLevelValue) *al = g.AccessLevelValue(accessLevel.Value()) at, _, err := gc.client.ProjectAccessTokens.CreateProjectAccessToken(projectId, &g.CreateProjectAccessTokenOptions{ @@ -333,7 +334,7 @@ func (gc *gitlabClient) CreateProjectAccessToken(projectId string, name string, }, nil } -func (gc *gitlabClient) RevokePersonalAccessToken(tokenId int) (err error) { +func (gc *gitlabClient) RevokePersonalAccessToken(ctx context.Context, tokenId int) (err error) { defer func() { gc.logger.Debug("Revoke personal access token", "tokenId", tokenId, "error", err) }() @@ -348,7 +349,7 @@ func (gc *gitlabClient) RevokePersonalAccessToken(tokenId int) (err error) { return nil } -func (gc *gitlabClient) RevokeProjectAccessToken(tokenId int, projectId string) (err error) { +func (gc *gitlabClient) RevokeProjectAccessToken(ctx context.Context, tokenId int, projectId string) (err error) { defer func() { gc.logger.Debug("Revoke project access token", "tokenId", tokenId, "error", err) }() @@ -363,7 +364,7 @@ func (gc *gitlabClient) RevokeProjectAccessToken(tokenId int, projectId string) return nil } -func (gc *gitlabClient) RevokeGroupAccessToken(tokenId int, groupId string) (err error) { +func (gc *gitlabClient) RevokeGroupAccessToken(ctx context.Context, tokenId int, groupId string) (err error) { defer func() { gc.logger.Debug("Revoke group access token", "tokenId", tokenId, "error", err) }() @@ -378,7 +379,7 @@ func (gc *gitlabClient) RevokeGroupAccessToken(tokenId int, groupId string) (err return nil } -func (gc *gitlabClient) Valid() bool { +func (gc *gitlabClient) Valid(ctx context.Context) bool { return gc.client != nil && gc.config != nil } diff --git a/gitlab_client_test.go b/gitlab_client_test.go index 4037c77..bb875b9 100644 --- a/gitlab_client_test.go +++ b/gitlab_client_test.go @@ -1,10 +1,10 @@ package gitlab_test import ( + "context" "io" "net/http" "testing" - "time" log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/helper/logging" @@ -43,18 +43,20 @@ func TestGitlabClient(t *testing.T) { }) t.Run("revoke service account token with empty token", func(t *testing.T) { + var ctx = context.Background() var client, err = gitlab.NewGitlabClient(&gitlab.EntryConfig{ Token: "token", BaseURL: "https://example.com", }, &http.Client{}, nil) require.NoError(t, err) require.NotNil(t, client) - require.ErrorIs(t, client.RevokeGroupServiceAccountAccessToken(""), gitlab.ErrNilValue) - require.ErrorIs(t, client.RevokeUserServiceAccountAccessToken(""), gitlab.ErrNilValue) + require.ErrorIs(t, client.RevokeGroupServiceAccountAccessToken(ctx, ""), gitlab.ErrNilValue) + require.ErrorIs(t, client.RevokeUserServiceAccountAccessToken(ctx, ""), gitlab.ErrNilValue) }) } func TestGitlabClient_InvalidToken(t *testing.T) { + ctx, timeExpiresAt := ctxTestTime(context.Background(), t.Name()) var err error httpClient, url := getClient(t) var client gitlab.Client @@ -65,38 +67,39 @@ func TestGitlabClient_InvalidToken(t *testing.T) { require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - token, err := client.CurrentTokenInfo() + token, err := client.CurrentTokenInfo(ctx) require.Error(t, err) require.Nil(t, token) - newToken, oldToken, err := client.RotateCurrentToken() + newToken, oldToken, err := client.RotateCurrentToken(ctx) require.Error(t, err) require.Nil(t, newToken) require.Nil(t, oldToken) - require.Error(t, client.RevokePersonalAccessToken(1)) - require.Error(t, client.RevokeGroupAccessToken(1, "group")) - require.Error(t, client.RevokeProjectAccessToken(1, "project")) + require.Error(t, client.RevokePersonalAccessToken(ctx, 1)) + require.Error(t, client.RevokeGroupAccessToken(ctx, 1, "group")) + require.Error(t, client.RevokeProjectAccessToken(ctx, 1, "project")) - _, err = client.GetUserIdByUsername("username") + _, err = client.GetUserIdByUsername(ctx, "username") require.Error(t, err) - entryToken, err := client.CreateGroupAccessToken("groupId", "name", time.Now(), []string{"scope"}, gitlab.AccessLevelUnknown) + entryToken, err := client.CreateGroupAccessToken(ctx, "groupId", "name", timeExpiresAt, []string{"scope"}, gitlab.AccessLevelUnknown) require.Error(t, err) require.Nil(t, entryToken) - entryToken, err = client.CreateProjectAccessToken("projectId", "name", time.Now(), []string{"scope"}, gitlab.AccessLevelUnknown) + entryToken, err = client.CreateProjectAccessToken(ctx, "projectId", "name", timeExpiresAt, []string{"scope"}, gitlab.AccessLevelUnknown) require.Error(t, err) require.Nil(t, entryToken) - entryToken, err = client.CreatePersonalAccessToken("username", 0, "name", time.Now(), []string{"scope"}) + entryToken, err = client.CreatePersonalAccessToken(ctx, "username", 0, "name", timeExpiresAt, []string{"scope"}) require.Error(t, err) require.Nil(t, entryToken) } func TestGitlabClient_RevokeToken_NotFound(t *testing.T) { + var ctx = context.Background() var err error httpClient, url := getClient(t) var client gitlab.Client @@ -107,14 +110,15 @@ func TestGitlabClient_RevokeToken_NotFound(t *testing.T) { require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - require.ErrorIs(t, client.RevokePersonalAccessToken(999), gitlab.ErrAccessTokenNotFound) - require.ErrorIs(t, client.RevokeGroupAccessToken(999, "group"), gitlab.ErrAccessTokenNotFound) - require.ErrorIs(t, client.RevokeProjectAccessToken(999, "project"), gitlab.ErrAccessTokenNotFound) + require.ErrorIs(t, client.RevokePersonalAccessToken(ctx, 999), gitlab.ErrAccessTokenNotFound) + require.ErrorIs(t, client.RevokeGroupAccessToken(ctx, 999, "group"), gitlab.ErrAccessTokenNotFound) + require.ErrorIs(t, client.RevokeProjectAccessToken(ctx, 999, "project"), gitlab.ErrAccessTokenNotFound) } func TestGitlabClient_GetGroupIdByPath(t *testing.T) { + var ctx = context.Background() var err error httpClient, url := getClient(t) var client gitlab.Client @@ -124,17 +128,18 @@ func TestGitlabClient_GetGroupIdByPath(t *testing.T) { }, httpClient, nil) require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - groupId, err := client.GetGroupIdByPath("test") + groupId, err := client.GetGroupIdByPath(ctx, "test") require.NoError(t, err) require.EqualValues(t, 37, groupId) - _, err = client.GetGroupIdByPath("nonexistent") + _, err = client.GetGroupIdByPath(ctx, "nonexistent") require.ErrorIs(t, err, gitlab.ErrInvalidValue) } func TestGitlabClient_GetUserIdByUsername(t *testing.T) { + var ctx = context.Background() var err error httpClient, url := getClient(t) var client gitlab.Client @@ -144,15 +149,16 @@ func TestGitlabClient_GetUserIdByUsername(t *testing.T) { }, httpClient, nil) require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - userId, err := client.GetUserIdByUsername("root") + userId, err := client.GetUserIdByUsername(ctx, "root") require.NoError(t, err) require.EqualValues(t, 1, userId) } func TestGitlabClient_GetUserIdByUsernameDoesNotMatch(t *testing.T) { var err error + var ctx = context.Background() httpClient, url := getClient(t) var client gitlab.Client client, err = gitlab.NewGitlabClient(&gitlab.EntryConfig{ @@ -161,18 +167,19 @@ func TestGitlabClient_GetUserIdByUsernameDoesNotMatch(t *testing.T) { }, httpClient, nil) require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - userId, err := client.GetUserIdByUsername("ilijamt") + userId, err := client.GetUserIdByUsername(ctx, "ilijamt") require.ErrorIs(t, err, gitlab.ErrInvalidValue) require.NotEqualValues(t, 1, userId) - userId, err = client.GetUserIdByUsername("demo") + userId, err = client.GetUserIdByUsername(ctx, "demo") require.ErrorIs(t, err, gitlab.ErrInvalidValue) require.NotEqualValues(t, 1, userId) } func TestGitlabClient_Revoke_NonExistingTokens(t *testing.T) { + var ctx = context.Background() var err error httpClient, url := getClient(t) var client gitlab.Client @@ -182,15 +189,16 @@ func TestGitlabClient_Revoke_NonExistingTokens(t *testing.T) { }, httpClient, nil) require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - require.Error(t, client.RevokePersonalAccessToken(999)) - require.Error(t, client.RevokeGroupAccessToken(999, "example")) - require.Error(t, client.RevokeProjectAccessToken(999, "example/example")) + require.Error(t, client.RevokePersonalAccessToken(ctx, 999)) + require.Error(t, client.RevokeGroupAccessToken(ctx, 999, "example")) + require.Error(t, client.RevokeProjectAccessToken(ctx, 999, "example/example")) } func TestGitlabClient_CurrentTokenInfo(t *testing.T) { var err error + var ctx = context.Background() httpClient, url := getClient(t) var client gitlab.Client client, err = gitlab.NewGitlabClient(&gitlab.EntryConfig{ @@ -199,9 +207,9 @@ func TestGitlabClient_CurrentTokenInfo(t *testing.T) { }, httpClient, nil) require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) - token, err := client.CurrentTokenInfo() + token, err := client.CurrentTokenInfo(ctx) require.NoError(t, err) require.NotNil(t, token) assert.EqualValues(t, gitlab.TokenTypePersonal, token.TokenType) @@ -209,6 +217,7 @@ func TestGitlabClient_CurrentTokenInfo(t *testing.T) { func TestGitlabClient_CreateAccessToken_And_Revoke(t *testing.T) { var err error + ctx, timeExpiresAt := ctxTestTime(context.Background(), t.Name()) httpClient, url := getClient(t) var client gitlab.Client client, err = gitlab.NewGitlabClient(&gitlab.EntryConfig{ @@ -217,12 +226,13 @@ func TestGitlabClient_CreateAccessToken_And_Revoke(t *testing.T) { }, httpClient, nil) require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) + require.True(t, client.Valid(ctx)) entryToken, err := client.CreateGroupAccessToken( + ctx, "example", "name", - time.Now(), + timeExpiresAt, []string{gitlab.TokenScopeReadApi.String()}, gitlab.AccessLevelGuestPermissions, ) @@ -230,12 +240,13 @@ func TestGitlabClient_CreateAccessToken_And_Revoke(t *testing.T) { require.NotNil(t, entryToken) require.EqualValues(t, gitlab.TokenTypeGroup, entryToken.TokenType) require.NotEmpty(t, entryToken.Token) - require.NoError(t, client.RevokeGroupAccessToken(entryToken.TokenID, "example")) + require.NoError(t, client.RevokeGroupAccessToken(ctx, entryToken.TokenID, "example")) entryToken, err = client.CreateProjectAccessToken( + ctx, "example/example", "name", - time.Now(), + timeExpiresAt, []string{gitlab.TokenScopeReadApi.String()}, gitlab.AccessLevelDeveloperPermissions, ) @@ -243,24 +254,26 @@ func TestGitlabClient_CreateAccessToken_And_Revoke(t *testing.T) { require.NotNil(t, entryToken) require.EqualValues(t, gitlab.TokenTypeProject, entryToken.TokenType) require.NotEmpty(t, entryToken.Token) - require.NoError(t, client.RevokeProjectAccessToken(entryToken.TokenID, "example/example")) + require.NoError(t, client.RevokeProjectAccessToken(ctx, entryToken.TokenID, "example/example")) entryToken, err = client.CreatePersonalAccessToken( + ctx, "normal-user", 1, "name", - time.Now(), + timeExpiresAt, []string{gitlab.TokenScopeReadApi.String()}, ) require.NoError(t, err) require.NotNil(t, entryToken) require.EqualValues(t, gitlab.TokenTypePersonal, entryToken.TokenType) require.NotEmpty(t, entryToken.Token) - require.NoError(t, client.RevokePersonalAccessToken(entryToken.TokenID)) + require.NoError(t, client.RevokePersonalAccessToken(ctx, entryToken.TokenID)) } func TestGitlabClient_RotateCurrentToken(t *testing.T) { var err error + var ctx = context.Background() httpClient, url := getClient(t) var client gitlab.Client client, err = gitlab.NewGitlabClient(&gitlab.EntryConfig{ @@ -270,9 +283,9 @@ func TestGitlabClient_RotateCurrentToken(t *testing.T) { require.NoError(t, err) require.NotNil(t, client) - require.True(t, client.Valid()) - - newToken, oldToken, err := client.RotateCurrentToken() + require.True(t, client.Valid(ctx)) + ctx, _ = ctxTestTime(ctx, t.Name()) + newToken, oldToken, err := client.RotateCurrentToken(ctx) require.NoError(t, err) require.NotNil(t, newToken) require.NotNil(t, oldToken) diff --git a/helpers_test.go b/helpers_test.go index 02978d6..a1b7159 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -175,7 +175,7 @@ type inMemoryClient struct { accessTokens map[string]gitlab.EntryToken } -func (i *inMemoryClient) GetGroupIdByPath(path string) (int, error) { +func (i *inMemoryClient) GetGroupIdByPath(ctx context.Context, path string) (int, error) { idx := slices.Index(i.groups, path) if idx == -1 { i.users = append(i.groups, path) @@ -184,11 +184,11 @@ func (i *inMemoryClient) GetGroupIdByPath(path string) (int, error) { return idx, nil } -func (i *inMemoryClient) GitlabClient() *g.Client { +func (i *inMemoryClient) GitlabClient(ctx context.Context) *g.Client { return nil } -func (i *inMemoryClient) CreateGroupServiceAccountAccessToken(path string, groupId string, userId int, name string, expiresAt time.Time, scopes []string) (*gitlab.EntryToken, error) { +func (i *inMemoryClient) CreateGroupServiceAccountAccessToken(ctx context.Context, path string, groupId string, userId int, name string, expiresAt time.Time, scopes []string) (*gitlab.EntryToken, error) { i.muLock.Lock() defer i.muLock.Unlock() if i.createGroupServiceAccountAccessTokenError { @@ -197,17 +197,17 @@ func (i *inMemoryClient) CreateGroupServiceAccountAccessToken(path string, group return nil, nil } -func (i *inMemoryClient) CreateUserServiceAccountAccessToken(username string, userId int, name string, expiresAt time.Time, scopes []string) (*gitlab.EntryToken, error) { +func (i *inMemoryClient) CreateUserServiceAccountAccessToken(ctx context.Context, username string, userId int, name string, expiresAt time.Time, scopes []string) (*gitlab.EntryToken, error) { i.muLock.Lock() if i.createUserServiceAccountAccessTokenError { i.muLock.Unlock() return nil, fmt.Errorf("CreateUserServiceAccountAccessToken") } i.muLock.Unlock() - return i.CreatePersonalAccessToken(username, userId, name, expiresAt, scopes) + return i.CreatePersonalAccessToken(ctx, username, userId, name, expiresAt, scopes) } -func (i *inMemoryClient) RevokeUserServiceAccountAccessToken(token string) error { +func (i *inMemoryClient) RevokeUserServiceAccountAccessToken(ctx context.Context, token string) error { i.muLock.Lock() defer i.muLock.Unlock() if i.revokeUserServiceAccountPersonalAccessTokenError { @@ -217,7 +217,7 @@ func (i *inMemoryClient) RevokeUserServiceAccountAccessToken(token string) error return nil } -func (i *inMemoryClient) RevokeGroupServiceAccountAccessToken(token string) error { +func (i *inMemoryClient) RevokeGroupServiceAccountAccessToken(ctx context.Context, token string) error { i.muLock.Lock() defer i.muLock.Unlock() if i.revokeGroupServiceAccountPersonalAccessTokenError { @@ -227,28 +227,28 @@ func (i *inMemoryClient) RevokeGroupServiceAccountAccessToken(token string) erro return nil } -func (i *inMemoryClient) CurrentTokenInfo() (*gitlab.EntryToken, error) { +func (i *inMemoryClient) CurrentTokenInfo(ctx context.Context) (*gitlab.EntryToken, error) { i.muLock.Lock() defer i.muLock.Unlock() i.calledMainToken++ return &i.mainTokenInfo, nil } -func (i *inMemoryClient) RotateCurrentToken() (*gitlab.EntryToken, *gitlab.EntryToken, error) { +func (i *inMemoryClient) RotateCurrentToken(ctx context.Context) (*gitlab.EntryToken, *gitlab.EntryToken, error) { i.muLock.Lock() defer i.muLock.Unlock() i.calledRotateMainToken++ return &i.rotateMainToken, &i.mainTokenInfo, nil } -func (i *inMemoryClient) Valid() bool { +func (i *inMemoryClient) Valid(ctx context.Context) bool { i.muLock.Lock() defer i.muLock.Unlock() i.calledValid++ return i.valid } -func (i *inMemoryClient) CreatePersonalAccessToken(username string, userId int, name string, expiresAt time.Time, scopes []string) (*gitlab.EntryToken, error) { +func (i *inMemoryClient) CreatePersonalAccessToken(ctx context.Context, username string, userId int, name string, expiresAt time.Time, scopes []string) (*gitlab.EntryToken, error) { i.muLock.Lock() defer i.muLock.Unlock() if i.personalAccessTokenCreateError { @@ -272,7 +272,7 @@ func (i *inMemoryClient) CreatePersonalAccessToken(username string, userId int, return &entryToken, nil } -func (i *inMemoryClient) CreateGroupAccessToken(groupId string, name string, expiresAt time.Time, scopes []string, accessLevel gitlab.AccessLevel) (*gitlab.EntryToken, error) { +func (i *inMemoryClient) CreateGroupAccessToken(ctx context.Context, groupId string, name string, expiresAt time.Time, scopes []string, accessLevel gitlab.AccessLevel) (*gitlab.EntryToken, error) { i.muLock.Lock() defer i.muLock.Unlock() if i.groupAccessTokenCreateError { @@ -297,7 +297,7 @@ func (i *inMemoryClient) CreateGroupAccessToken(groupId string, name string, exp return &entryToken, nil } -func (i *inMemoryClient) CreateProjectAccessToken(projectId string, name string, expiresAt time.Time, scopes []string, accessLevel gitlab.AccessLevel) (*gitlab.EntryToken, error) { +func (i *inMemoryClient) CreateProjectAccessToken(ctx context.Context, projectId string, name string, expiresAt time.Time, scopes []string, accessLevel gitlab.AccessLevel) (*gitlab.EntryToken, error) { i.muLock.Lock() defer i.muLock.Unlock() if i.projectAccessTokenCreateError { @@ -322,7 +322,7 @@ func (i *inMemoryClient) CreateProjectAccessToken(projectId string, name string, return &entryToken, nil } -func (i *inMemoryClient) RevokePersonalAccessToken(tokenId int) error { +func (i *inMemoryClient) RevokePersonalAccessToken(ctx context.Context, tokenId int) error { i.muLock.Lock() defer i.muLock.Unlock() if i.personalAccessTokenRevokeError { @@ -332,7 +332,7 @@ func (i *inMemoryClient) RevokePersonalAccessToken(tokenId int) error { return nil } -func (i *inMemoryClient) RevokeProjectAccessToken(tokenId int, projectId string) error { +func (i *inMemoryClient) RevokeProjectAccessToken(ctx context.Context, tokenId int, projectId string) error { i.muLock.Lock() defer i.muLock.Unlock() if i.projectAccessTokenRevokeError { @@ -342,7 +342,7 @@ func (i *inMemoryClient) RevokeProjectAccessToken(tokenId int, projectId string) return nil } -func (i *inMemoryClient) RevokeGroupAccessToken(tokenId int, groupId string) error { +func (i *inMemoryClient) RevokeGroupAccessToken(ctx context.Context, tokenId int, groupId string) error { i.muLock.Lock() defer i.muLock.Unlock() if i.groupAccessTokenRevokeError { @@ -352,7 +352,7 @@ func (i *inMemoryClient) RevokeGroupAccessToken(tokenId int, groupId string) err return nil } -func (i *inMemoryClient) GetUserIdByUsername(username string) (int, error) { +func (i *inMemoryClient) GetUserIdByUsername(ctx context.Context, username string) (int, error) { idx := slices.Index(i.users, username) if idx == -1 { i.users = append(i.users, username) @@ -386,3 +386,13 @@ func getCtxGitlabClientWithUrl(t *testing.T) (context.Context, string) { httpClient, url := getClient(t) return gitlab.HttpClientNewContext(context.Background(), httpClient), url } + +func ctxTestTime(ctx context.Context, tn string) (_ context.Context, t time.Time) { + switch tn { + case "TestGitlabClient_RotateCurrentToken", "TestWithGitlabUser_RotateToken": + t = time.Date(2024, 8, 12, 0, 0, 0, 0, time.UTC) + default: + t = time.Date(2024, 12, 12, 0, 0, 0, 0, time.UTC) + } + return gitlab.WithStaticTime(ctx, t), t +} diff --git a/path_config.go b/path_config.go index 98a85c2..a759686 100644 --- a/path_config.go +++ b/path_config.go @@ -162,7 +162,7 @@ func (b *Backend) updateConfigClientInfo(ctx context.Context, config *EntryConfi } } - et, err = client.CurrentTokenInfo() + et, err = client.CurrentTokenInfo(ctx) if err != nil { return et, fmt.Errorf("token cannot be validated: %s", ErrInvalidValue) } diff --git a/path_config_rotate.go b/path_config_rotate.go index 9c3a071..d04e5e2 100644 --- a/path_config_rotate.go +++ b/path_config_rotate.go @@ -82,7 +82,7 @@ func (b *Backend) pathConfigTokenRotate(ctx context.Context, request *logical.Re } var entryToken *EntryToken - entryToken, _, err = client.RotateCurrentToken() + entryToken, _, err = client.RotateCurrentToken(ctx) if err != nil { b.Logger().Error("Failed to rotate main token", "err", err) return nil, err diff --git a/path_config_test.go b/path_config_test.go index 0156798..f0eee0f 100644 --- a/path_config_test.go +++ b/path_config_test.go @@ -217,7 +217,7 @@ func TestPathConfig(t *testing.T) { tokenOriginalSha1Hash := resp.Data["token_sha1_hash"].(string) require.NotEmpty(t, tokenOriginalSha1Hash) require.Equal(t, gitlab.TypeSelfManaged.String(), resp.Data["type"]) - require.NotNil(t, b.GetClient(gitlab.DefaultConfigName).GitlabClient()) + require.NotNil(t, b.GetClient(gitlab.DefaultConfigName).GitlabClient(ctx)) resp, err = b.HandleRequest(ctx, &logical.Request{ Operation: logical.PatchOperation, @@ -235,7 +235,7 @@ func TestPathConfig(t *testing.T) { require.NotEqual(t, tokenOriginalSha1Hash, tokenNewSha1Hash) require.Equal(t, gitlab.TypeSaaS.String(), resp.Data["type"]) - require.NotNil(t, b.GetClient(gitlab.DefaultConfigName).GitlabClient()) + require.NotNil(t, b.GetClient(gitlab.DefaultConfigName).GitlabClient(ctx)) events.expectEvents(t, []expectedEvent{ {eventType: "gitlab/config-write"}, diff --git a/path_token_role.go b/path_token_role.go index 167c70b..835b59a 100644 --- a/path_token_role.go +++ b/path_token_role.go @@ -59,7 +59,7 @@ func (b *Backend) pathTokenRoleCreate(ctx context.Context, req *logical.Request, var name string var token *EntryToken var expiresAt time.Time - var startTime = time.Now().UTC() + var startTime = TimeFromContext(ctx).UTC() name, err = TokenName(role) if err != nil { @@ -80,22 +80,22 @@ func (b *Backend) pathTokenRoleCreate(ctx context.Context, req *logical.Request, switch role.TokenType { case TokenTypeGroup: b.Logger().Debug("Creating group access token for role", "path", role.Path, "name", name, "expiresAt", expiresAt, "scopes", role.Scopes, "accessLevel", role.AccessLevel) - token, err = client.CreateGroupAccessToken(role.Path, name, expiresAt, role.Scopes, role.AccessLevel) + token, err = client.CreateGroupAccessToken(ctx, role.Path, name, expiresAt, role.Scopes, role.AccessLevel) case TokenTypeProject: b.Logger().Debug("Creating project access token for role", "path", role.Path, "name", name, "expiresAt", expiresAt, "scopes", role.Scopes, "accessLevel", role.AccessLevel) - token, err = client.CreateProjectAccessToken(role.Path, name, expiresAt, role.Scopes, role.AccessLevel) + token, err = client.CreateProjectAccessToken(ctx, role.Path, name, expiresAt, role.Scopes, role.AccessLevel) case TokenTypePersonal: var userId int - userId, err = client.GetUserIdByUsername(role.Path) + userId, err = client.GetUserIdByUsername(ctx, role.Path) if err == nil { b.Logger().Debug("Creating personal access token for role", "path", role.Path, "userId", userId, "name", name, "expiresAt", expiresAt, "scopes", role.Scopes) - token, err = client.CreatePersonalAccessToken(role.Path, userId, name, expiresAt, role.Scopes) + token, err = client.CreatePersonalAccessToken(ctx, role.Path, userId, name, expiresAt, role.Scopes) } case TokenTypeUserServiceAccount: var userId int - if userId, err = client.GetUserIdByUsername(role.Path); err == nil { + if userId, err = client.GetUserIdByUsername(ctx, role.Path); err == nil { b.Logger().Debug("Creating user service account access token for role", "path", role.Path, "userId", userId, "name", name, "expiresAt", expiresAt, "scopes", role.Scopes) - token, err = client.CreateUserServiceAccountAccessToken(role.Path, userId, name, expiresAt, role.Scopes) + token, err = client.CreateUserServiceAccountAccessToken(ctx, role.Path, userId, name, expiresAt, role.Scopes) } case TokenTypeGroupServiceAccount: var serviceAccount, groupId string @@ -105,9 +105,9 @@ func (b *Backend) pathTokenRoleCreate(ctx context.Context, req *logical.Request, } var userId int - if userId, err = client.GetUserIdByUsername(serviceAccount); err == nil { + if userId, err = client.GetUserIdByUsername(ctx, serviceAccount); err == nil { b.Logger().Debug("Creating group service account access token for role", "path", role.Path, "groupId", groupId, "userId", userId, "name", name, "expiresAt", expiresAt, "scopes", role.Scopes) - token, err = client.CreateGroupServiceAccountAccessToken(role.Path, groupId, userId, name, expiresAt, role.Scopes) + token, err = client.CreateGroupServiceAccountAccessToken(ctx, role.Path, groupId, userId, name, expiresAt, role.Scopes) } default: return logical.ErrorResponse("invalid token type"), fmt.Errorf("%s: %w", role.TokenType.String(), ErrUnknownTokenType) diff --git a/path_token_role_multiple_config_test.go b/path_token_role_multiple_config_test.go index efb65b8..9551be8 100644 --- a/path_token_role_multiple_config_test.go +++ b/path_token_role_multiple_config_test.go @@ -86,7 +86,8 @@ func TestPathTokenRolesMultipleConfigs(t *testing.T) { require.Empty(t, resp.Warnings) require.EqualValues(t, cfg, resp.Data["config_name"]) - resp, err = b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err = b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/%s", gitlab.PathTokenRoleStorage, rd.rn), }) diff --git a/secret_access_tokens.go b/secret_access_tokens.go index a02f79c..d156c61 100644 --- a/secret_access_tokens.go +++ b/secret_access_tokens.go @@ -96,17 +96,17 @@ func (b *Backend) secretAccessTokenRevoke(ctx context.Context, req *logical.Requ switch tokenType { case TokenTypePersonal: - err = client.RevokePersonalAccessToken(tokenId) + err = client.RevokePersonalAccessToken(ctx, tokenId) case TokenTypeProject: - err = client.RevokeProjectAccessToken(tokenId, parentId) + err = client.RevokeProjectAccessToken(ctx, tokenId, parentId) case TokenTypeGroup: - err = client.RevokeGroupAccessToken(tokenId, parentId) + err = client.RevokeGroupAccessToken(ctx, tokenId, parentId) case TokenTypeUserServiceAccount: var token = req.Secret.InternalData["token"].(string) - err = client.RevokeUserServiceAccountAccessToken(token) + err = client.RevokeUserServiceAccountAccessToken(ctx, token) case TokenTypeGroupServiceAccount: var token = req.Secret.InternalData["token"].(string) - err = client.RevokeGroupServiceAccountAccessToken(token) + err = client.RevokeGroupServiceAccountAccessToken(ctx, token) } if err != nil && !errors.Is(err, ErrAccessTokenNotFound) { diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml index 0d52b31..056ef0e 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_CreateAccessToken_And_Revoke.yaml @@ -12,7 +12,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","scopes":["read_api"],"access_level":10,"expires_at":"2024-10-12"}' + body: '{"name":"name","scopes":["read_api"],"access_level":10,"expires_at":"2024-12-12"}' form: {} headers: Accept: @@ -31,22 +31,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 230 + content_length: 228 uncompressed: false - body: '{"id":57,"name":"name","revoked":false,"created_at":"2024-10-12T07:06:07.977Z","scopes":["read_api"],"user_id":15,"last_used_at":null,"active":false,"expires_at":"2024-10-12","access_level":10,"token":"glpat-_qFUvELnkVDX7y82uE3m"}' + body: '{"id":43,"name":"name","revoked":false,"created_at":"2024-10-13T12:28:01.037Z","scopes":["read_api"],"user_id":4,"last_used_at":null,"active":true,"expires_at":"2024-12-12","access_level":10,"token":"glpat-Mz4WG_bzFns_o1BoCXZw"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "230" + - "228" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:06:08 GMT + - Sun, 13 Oct 2024 12:28:01 GMT Etag: - - W/"bb3712a091f99d106128bd2b2feefa08" + - W/"690d4dfc4d34fda6189e470979599865" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -60,14 +60,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRS0C4VPX3E7RPV7D1D5XD","version":"1"}' + - '{"correlation_id":"01JA2XK3VETYS0RV9VJMQZHDV0","version":"1"}' X-Request-Id: - - 01J9ZRS0C4VPX3E7RPV7D1D5XD + - 01JA2XK3VETYS0RV9VJMQZHDV0 X-Runtime: - - "0.383336" + - "0.293273" status: 201 Created code: 201 - duration: 394.514167ms + duration: 296.343375ms - id: 1 request: proto: HTTP/1.1 @@ -88,7 +88,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/groups/example/access_tokens/57 + url: http://localhost:8080/api/v4/groups/example/access_tokens/43 method: DELETE response: proto: HTTP/1.1 @@ -105,7 +105,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 07:06:08 GMT + - Sun, 13 Oct 2024 12:28:01 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -119,14 +119,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRS14PEHCNN4H5W2G6J5ZG","version":"1"}' + - '{"correlation_id":"01JA2XK4E2NSV24WWKHAA0S4HT","version":"1"}' X-Request-Id: - - 01J9ZRS14PEHCNN4H5W2G6J5ZG + - 01JA2XK4E2NSV24WWKHAA0S4HT X-Runtime: - - "0.251326" + - "0.108264" status: 204 No Content code: 204 - duration: 260.777417ms + duration: 115.732833ms - id: 2 request: proto: HTTP/1.1 @@ -138,7 +138,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","scopes":["read_api"],"access_level":30,"expires_at":"2024-10-12"}' + body: '{"name":"name","scopes":["read_api"],"access_level":30,"expires_at":"2024-12-12"}' form: {} headers: Accept: @@ -157,22 +157,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 230 + content_length: 228 uncompressed: false - body: '{"id":58,"name":"name","revoked":false,"created_at":"2024-10-12T07:06:09.085Z","scopes":["read_api"],"user_id":16,"last_used_at":null,"active":false,"expires_at":"2024-10-12","access_level":30,"token":"glpat-2qeH8Wtkkk2s__dMgzmR"}' + body: '{"id":44,"name":"name","revoked":false,"created_at":"2024-10-13T12:28:01.893Z","scopes":["read_api"],"user_id":5,"last_used_at":null,"active":true,"expires_at":"2024-12-12","access_level":30,"token":"glpat-wy-XyAGNxoj-Eobgfi-R"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "230" + - "228" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:06:09 GMT + - Sun, 13 Oct 2024 12:28:01 GMT Etag: - - W/"7b19175c8bc1bda9de666310c1b3eb72" + - W/"2994a64698cbfcdd4a8ee798e96a6cfe" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -186,14 +186,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRS1N1855PN3ZEA29Z3W2B","version":"1"}' + - '{"correlation_id":"01JA2XK4N94C36DY6WVZFAKPVC","version":"1"}' X-Request-Id: - - 01J9ZRS1N1855PN3ZEA29Z3W2B + - 01JA2XK4N94C36DY6WVZFAKPVC X-Runtime: - - "0.158302" + - "0.319914" status: 201 Created code: 201 - duration: 164.414542ms + duration: 323.0955ms - id: 3 request: proto: HTTP/1.1 @@ -214,7 +214,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/58 + url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/44 method: DELETE response: proto: HTTP/1.1 @@ -231,7 +231,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 07:06:09 GMT + - Sun, 13 Oct 2024 12:28:02 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -245,14 +245,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRS1ZD2EE07SDA7GMNXV9K","version":"1"}' + - '{"correlation_id":"01JA2XK59KT0Y5HWZD3Y7TJDV1","version":"1"}' X-Request-Id: - - 01J9ZRS1ZD2EE07SDA7GMNXV9K + - 01JA2XK59KT0Y5HWZD3Y7TJDV1 X-Runtime: - - "0.086262" + - "0.177029" status: 204 No Content code: 204 - duration: 90.848834ms + duration: 184.856333ms - id: 4 request: proto: HTTP/1.1 @@ -264,7 +264,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","expires_at":"2024-10-12","scopes":["read_api"]}' + body: '{"name":"name","expires_at":"2024-12-12","scopes":["read_api"]}' form: {} headers: Accept: @@ -283,22 +283,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 211 + content_length: 210 uncompressed: false - body: '{"id":59,"name":"name","revoked":false,"created_at":"2024-10-12T07:06:09.599Z","scopes":["read_api"],"user_id":1,"last_used_at":null,"active":false,"expires_at":"2024-10-12","token":"glpat-P4_aJeMpW_HPf2R9ZUT-"}' + body: '{"id":45,"name":"name","revoked":false,"created_at":"2024-10-13T12:28:02.620Z","scopes":["read_api"],"user_id":1,"last_used_at":null,"active":true,"expires_at":"2024-12-12","token":"glpat-4PzriwzNC39CJbq5zveb"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "211" + - "210" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:06:09 GMT + - Sun, 13 Oct 2024 12:28:02 GMT Etag: - - W/"4767568b391be8a6046e467822bfd1c3" + - W/"251d45dbbe0af0528d20de74556b0e45" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -312,14 +312,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRS254TCFG21964W9NEMMT","version":"1"}' + - '{"correlation_id":"01JA2XK5N5WANNE87N6JJ8XNE3","version":"1"}' X-Request-Id: - - 01J9ZRS254TCFG21964W9NEMMT + - 01JA2XK5N5WANNE87N6JJ8XNE3 X-Runtime: - - "0.213275" + - "0.065718" status: 201 Created code: 201 - duration: 216.850292ms + duration: 69.537875ms - id: 5 request: proto: HTTP/1.1 @@ -340,7 +340,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/personal_access_tokens/59 + url: http://localhost:8080/api/v4/personal_access_tokens/45 method: DELETE response: proto: HTTP/1.1 @@ -357,7 +357,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 07:06:09 GMT + - Sun, 13 Oct 2024 12:28:02 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -371,11 +371,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRS2JSEZ3TBKRV6NTWWFTV","version":"1"}' + - '{"correlation_id":"01JA2XK5SHK45Y1FNNYEHQV4K7","version":"1"}' X-Request-Id: - - 01J9ZRS2JSEZ3TBKRV6NTWWFTV + - 01JA2XK5SHK45Y1FNNYEHQV4K7 X-Runtime: - - "0.070906" + - "0.061870" status: 204 No Content code: 204 - duration: 75.209959ms + duration: 64.560209ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_CurrentTokenInfo.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_CurrentTokenInfo.yaml index b6850db..0ff2d3d 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_CurrentTokenInfo.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_CurrentTokenInfo.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":1,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:26.792Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":1,"last_used_at":"2024-10-11T09:11:05.898Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":1,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:26.792Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":1,"last_used_at":"2024-10-13T12:27:58.084Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:08 GMT + - Sun, 13 Oct 2024 12:28:00 GMT Etag: - - W/"86a012f2542444285d00a390ed234220" + - W/"90e86831fcf88b60879463ac4225157a" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,11 +58,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH641PCNQ9H4D3ZFE6CRJ","version":"1"}' + - '{"correlation_id":"01JA2XK3T3EX89BJ1CRG1163SR","version":"1"}' X-Request-Id: - - 01J9XDH641PCNQ9H4D3ZFE6CRJ + - 01JA2XK3T3EX89BJ1CRG1163SR X-Runtime: - - "0.077499" + - "0.016680" status: 200 OK code: 200 - duration: 80.890333ms + duration: 19.699875ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_GetGroupIdByPath.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_GetGroupIdByPath.yaml index 81f0f0d..98e609a 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_GetGroupIdByPath.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_GetGroupIdByPath.yaml @@ -41,7 +41,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:06 GMT + - Sun, 13 Oct 2024 12:27:58 GMT Etag: - W/"a5a174aa9f8d8a0f74463379f0b3c209" Link: @@ -60,7 +60,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH49C54CKK6P3D1TM8Y34","version":"1"}' + - '{"correlation_id":"01JA2XK1K21S99HBNQJGAK1WZQ","version":"1"}' X-Next-Page: - "" X-Page: @@ -70,16 +70,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH49C54CKK6P3D1TM8Y34 + - 01JA2XK1K21S99HBNQJGAK1WZQ X-Runtime: - - "0.096532" + - "0.174229" X-Total: - "3" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 100.233625ms + duration: 178.760917ms - id: 1 request: proto: HTTP/1.1 @@ -121,7 +121,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:06 GMT + - Sun, 13 Oct 2024 12:27:58 GMT Etag: - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" Link: @@ -139,7 +139,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH4FTSD2M8YSSYKV8DBWN","version":"1"}' + - '{"correlation_id":"01JA2XK1YCHDHNHH6YJWEJ5REW","version":"1"}' X-Next-Page: - "" X-Page: @@ -149,13 +149,13 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH4FTSD2M8YSSYKV8DBWN + - 01JA2XK1YCHDHNHH6YJWEJ5REW X-Runtime: - - "0.113787" + - "0.184552" X-Total: - "0" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 117.924292ms + duration: 195.975417ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsername.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsername.yaml index 2d75f6b..2ce6df8 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsername.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsername.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '[{"id":1,"username":"root","name":"Administrator","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/258d8dc916db8cea2cafb6c3cd0cb0246efe061421dbd83ec3a350428cabda4f?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/root","created_at":"2024-07-11T18:51:40.925Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":"2024-07-11T18:54:22.894Z","confirmed_at":"2024-07-11T18:51:40.831Z","last_activity_on":"2024-10-11","email":"admin@example.com","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2024-10-11T07:48:06.781Z","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@example.com","is_admin":true,"note":null,"namespace_id":1,"created_by":null,"email_reset_offered_at":null}]' + body: '[{"id":1,"username":"root","name":"Administrator","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/258d8dc916db8cea2cafb6c3cd0cb0246efe061421dbd83ec3a350428cabda4f?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/root","created_at":"2024-07-11T18:51:40.925Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":"2024-07-11T18:54:22.894Z","confirmed_at":"2024-07-11T18:51:40.831Z","last_activity_on":"2024-10-13","email":"admin@example.com","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2024-10-11T07:48:06.781Z","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@example.com","is_admin":true,"note":null,"namespace_id":1,"created_by":null,"email_reset_offered_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:06 GMT + - Sun, 13 Oct 2024 12:27:59 GMT Etag: - - W/"cc2d9183e3c23bd6dadf1c14af135809" + - W/"ff413862d7bbfd875444c622c4921e00" Link: - ; rel="first", ; rel="last" Referrer-Policy: @@ -60,7 +60,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH4QAJ6NC9SWV98EMN18S","version":"1"}' + - '{"correlation_id":"01JA2XK2AP0NRNASN3C8BV69C5","version":"1"}' X-Next-Page: - "" X-Page: @@ -70,13 +70,13 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH4QAJ6NC9SWV98EMN18S + - 01JA2XK2AP0NRNASN3C8BV69C5 X-Runtime: - - "0.163589" + - "0.227706" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 166.815458ms + duration: 230.88875ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsernameDoesNotMatch.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsernameDoesNotMatch.yaml index 4c6c1c1..5e5cadc 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsernameDoesNotMatch.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_GetUserIdByUsernameDoesNotMatch.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:07 GMT + - Sun, 13 Oct 2024 12:27:59 GMT Etag: - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" Link: @@ -60,7 +60,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH51WJH64WAWN343D9SE8","version":"1"}' + - '{"correlation_id":"01JA2XK2SA2VH963B8SRC7JMCF","version":"1"}' X-Next-Page: - "" X-Page: @@ -70,16 +70,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH51WJH64WAWN343D9SE8 + - 01JA2XK2SA2VH963B8SRC7JMCF X-Runtime: - - "0.155170" + - "0.183937" X-Total: - "0" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 158.498834ms + duration: 193.2545ms - id: 1 request: proto: HTTP/1.1 @@ -121,7 +121,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:07 GMT + - Sun, 13 Oct 2024 12:28:00 GMT Etag: - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" Link: @@ -139,7 +139,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH5BVTHD0F22Y218S2H8S","version":"1"}' + - '{"correlation_id":"01JA2XK35DVD5VRQTEEHXV1K10","version":"1"}' X-Next-Page: - "" X-Page: @@ -149,13 +149,13 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9XDH5BVTHD0F22Y218S2H8S + - 01JA2XK35DVD5VRQTEEHXV1K10 X-Runtime: - - "0.083625" + - "0.159246" X-Total: - "0" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 87.446417ms + duration: 166.066708ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_InvalidToken.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_InvalidToken.yaml index 531ffca..4d80e8e 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_InvalidToken.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_InvalidToken.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:04 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -52,14 +52,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH2WZJXF5X68QJ9GZPJYD","version":"1"}' + - '{"correlation_id":"01JA2XK0N1S4K1065C4JKK7FZW","version":"1"}' X-Request-Id: - - 01J9XDH2WZJXF5X68QJ9GZPJYD + - 01JA2XK0N1S4K1065C4JKK7FZW X-Runtime: - - "0.101793" + - "0.068104" status: 401 Unauthorized code: 401 - duration: 126.2685ms + duration: 88.93025ms - id: 1 request: proto: HTTP/1.1 @@ -101,7 +101,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -111,14 +111,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH34MCFTY1VBH2RS80FVB","version":"1"}' + - '{"correlation_id":"01JA2XK0T8GBKYCZYCZYTR128J","version":"1"}' X-Request-Id: - - 01J9XDH34MCFTY1VBH2RS80FVB + - 01JA2XK0T8GBKYCZYCZYTR128J X-Runtime: - - "0.091717" + - "0.009570" status: 401 Unauthorized code: 401 - duration: 98.871291ms + duration: 12.795ms - id: 2 request: proto: HTTP/1.1 @@ -160,7 +160,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -170,14 +170,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3AVB4PS5D7BE5AJTFGS","version":"1"}' + - '{"correlation_id":"01JA2XK0V23B8RTZZQ8P7483S3","version":"1"}' X-Request-Id: - - 01J9XDH3AVB4PS5D7BE5AJTFGS + - 01JA2XK0V23B8RTZZQ8P7483S3 X-Runtime: - - "0.027357" + - "0.011357" status: 401 Unauthorized code: 401 - duration: 30.439167ms + duration: 13.806042ms - id: 3 request: proto: HTTP/1.1 @@ -219,7 +219,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -229,14 +229,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3CTKRF7PT9Y6GN7F90P","version":"1"}' + - '{"correlation_id":"01JA2XK0VZ7X7C3S9TYHHNVTSZ","version":"1"}' X-Request-Id: - - 01J9XDH3CTKRF7PT9Y6GN7F90P + - 01JA2XK0VZ7X7C3S9TYHHNVTSZ X-Runtime: - - "0.010791" + - "0.043766" status: 401 Unauthorized code: 401 - duration: 13.480542ms + duration: 46.485625ms - id: 4 request: proto: HTTP/1.1 @@ -278,7 +278,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -288,14 +288,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3DP74JX1PGAM5SNAXF9","version":"1"}' + - '{"correlation_id":"01JA2XK0YXWY2PHNK4XJJM2VH4","version":"1"}' X-Request-Id: - - 01J9XDH3DP74JX1PGAM5SNAXF9 + - 01JA2XK0YXWY2PHNK4XJJM2VH4 X-Runtime: - - "0.076665" + - "0.052846" status: 401 Unauthorized code: 401 - duration: 81.851167ms + duration: 55.746625ms - id: 5 request: proto: HTTP/1.1 @@ -337,7 +337,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -347,14 +347,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3JWA0M57MZ3NJVXCS0T","version":"1"}' + - '{"correlation_id":"01JA2XK12E4BEZ6QB576M293VQ","version":"1"}' X-Request-Id: - - 01J9XDH3JWA0M57MZ3NJVXCS0T + - 01JA2XK12E4BEZ6QB576M293VQ X-Runtime: - - "0.015838" + - "0.016749" status: 401 Unauthorized code: 401 - duration: 18.823916ms + duration: 19.454375ms - id: 6 request: proto: HTTP/1.1 @@ -366,7 +366,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","scopes":["scope"],"access_level":-1,"expires_at":"2024-10-11"}' + body: '{"name":"name","scopes":["scope"],"access_level":-1,"expires_at":"2024-12-12"}' form: {} headers: Accept: @@ -398,7 +398,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -408,14 +408,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3M46RWCF6T7HNQD6TBF","version":"1"}' + - '{"correlation_id":"01JA2XK13QVNE0S5TTNRZD9BBX","version":"1"}' X-Request-Id: - - 01J9XDH3M46RWCF6T7HNQD6TBF + - 01JA2XK13QVNE0S5TTNRZD9BBX X-Runtime: - - "0.084065" + - "0.015586" status: 401 Unauthorized code: 401 - duration: 89.894917ms + duration: 19.102833ms - id: 7 request: proto: HTTP/1.1 @@ -427,7 +427,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","scopes":["scope"],"access_level":-1,"expires_at":"2024-10-11"}' + body: '{"name":"name","scopes":["scope"],"access_level":-1,"expires_at":"2024-12-12"}' form: {} headers: Accept: @@ -459,7 +459,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:57 GMT Server: - nginx Vary: @@ -469,14 +469,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3SSP673Q613MSVNTKT6","version":"1"}' + - '{"correlation_id":"01JA2XK14ZFXHAHX6EYCFCP064","version":"1"}' X-Request-Id: - - 01J9XDH3SSP673Q613MSVNTKT6 + - 01JA2XK14ZFXHAHX6EYCFCP064 X-Runtime: - - "0.015038" + - "0.014638" status: 401 Unauthorized code: 401 - duration: 18.650709ms + duration: 17.091292ms - id: 8 request: proto: HTTP/1.1 @@ -488,7 +488,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"name","expires_at":"2024-10-11","scopes":["scope"]}' + body: '{"name":"name","expires_at":"2024-12-12","scopes":["scope"]}' form: {} headers: Accept: @@ -520,7 +520,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:58 GMT Server: - nginx Vary: @@ -530,11 +530,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3V040J2XHTTH7S1MY40","version":"1"}' + - '{"correlation_id":"01JA2XK162QS1E8HBCXG96ZE9R","version":"1"}' X-Request-Id: - - 01J9XDH3V040J2XHTTH7S1MY40 + - 01JA2XK162QS1E8HBCXG96ZE9R X-Runtime: - - "0.011736" + - "0.012494" status: 401 Unauthorized code: 401 - duration: 14.744167ms + duration: 15.038041ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_RevokeToken_NotFound.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_RevokeToken_NotFound.yaml index 97b0039..4553136 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_RevokeToken_NotFound.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_RevokeToken_NotFound.yaml @@ -42,20 +42,20 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:05 GMT + - Sun, 13 Oct 2024 12:27:58 GMT Server: - nginx Vary: - Origin X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH3W9ZK1MYV7GFNQSGXKJ","version":"1"}' + - '{"correlation_id":"01JA2XK176XRVT8RYM15YGW92X","version":"1"}' X-Request-Id: - - 01J9XDH3W9ZK1MYV7GFNQSGXKJ + - 01JA2XK176XRVT8RYM15YGW92X X-Runtime: - - "0.083114" + - "0.076812" status: 404 Not Found code: 404 - duration: 86.428291ms + duration: 79.292ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:06 GMT + - Sun, 13 Oct 2024 12:27:58 GMT Server: - nginx Vary: @@ -107,14 +107,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH41RYY811B5404PXT6SM","version":"1"}' + - '{"correlation_id":"01JA2XK1C724CTNYS11Q5BFS5M","version":"1"}' X-Request-Id: - - 01J9XDH41RYY811B5404PXT6SM + - 01JA2XK1C724CTNYS11Q5BFS5M X-Runtime: - - "0.031631" + - "0.027324" status: 404 Not Found code: 404 - duration: 35.11925ms + duration: 30.005875ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:06 GMT + - Sun, 13 Oct 2024 12:27:58 GMT Server: - nginx Vary: @@ -166,11 +166,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH43ZHMJGRTCB22SR58P3","version":"1"}' + - '{"correlation_id":"01JA2XK1E4T62H5BCKV7FJ3GS0","version":"1"}' X-Request-Id: - - 01J9XDH43ZHMJGRTCB22SR58P3 + - 01JA2XK1E4T62H5BCKV7FJ3GS0 X-Runtime: - - "0.079620" + - "0.074579" status: 404 Not Found code: 404 - duration: 83.164959ms + duration: 77.232916ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_Revoke_NonExistingTokens.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_Revoke_NonExistingTokens.yaml index fb40716..af3bc79 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_Revoke_NonExistingTokens.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_Revoke_NonExistingTokens.yaml @@ -42,20 +42,20 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:07 GMT + - Sun, 13 Oct 2024 12:28:00 GMT Server: - nginx Vary: - Origin X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH5HKXD87SM6B5SV10BYE","version":"1"}' + - '{"correlation_id":"01JA2XK3FYHW9R8EFZW6D0TATR","version":"1"}' X-Request-Id: - - 01J9XDH5HKXD87SM6B5SV10BYE + - 01JA2XK3FYHW9R8EFZW6D0TATR X-Runtime: - - "0.140943" + - "0.025061" status: 404 Not Found code: 404 - duration: 148.35525ms + duration: 30.981875ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:07 GMT + - Sun, 13 Oct 2024 12:28:00 GMT Server: - nginx Vary: @@ -107,14 +107,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH5TXVBED7NW2WRVS6PJE","version":"1"}' + - '{"correlation_id":"01JA2XK3HW7ZA58537YHRP3QQW","version":"1"}' X-Request-Id: - - 01J9XDH5TXVBED7NW2WRVS6PJE + - 01JA2XK3HW7ZA58537YHRP3QQW X-Runtime: - - "0.061760" + - "0.058143" status: 404 Not Found code: 404 - duration: 64.709959ms + duration: 61.803917ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: Content-Type: - application/json Date: - - Fri, 11 Oct 2024 09:11:08 GMT + - Sun, 13 Oct 2024 12:28:00 GMT Server: - nginx Vary: @@ -166,11 +166,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9XDH5YZSP4QJ5KZ6F9XS7VR","version":"1"}' + - '{"correlation_id":"01JA2XK3NSWTZKWTYQWJDN8AEZ","version":"1"}' X-Request-Id: - - 01J9XDH5YZSP4QJ5KZ6F9XS7VR + - 01JA2XK3NSWTZKWTYQWJDN8AEZ X-Runtime: - - "0.073281" + - "0.064515" status: 404 Not Found code: 404 - duration: 76.879ms + duration: 67.39075ms diff --git a/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml b/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml index c8bb96c..f5986ac 100644 --- a/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml +++ b/testdata/fixtures/16.11.6/TestGitlabClient_RotateCurrentToken.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":6,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-07-11T18:55:07.266Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:10:20.890Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":6,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-07-11T18:55:07.266Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-13T12:28:02.879Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:10:20 GMT + - Sun, 13 Oct 2024 12:28:02 GMT Etag: - - W/"689dbad88defd51245c35eadab14fb89" + - W/"f9b1f31034f7470b57f6d4b35821dc05" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS0QKC3CXKDPMGH2XEYA8K","version":"1"}' + - '{"correlation_id":"01JA2XK5XNFVGWRJHFJRKR9HJ2","version":"1"}' X-Request-Id: - - 01J9ZS0QKC3CXKDPMGH2XEYA8K + - 01JA2XK5XNFVGWRJHFJRKR9HJ2 X-Runtime: - - "0.211059" + - "0.032270" status: 200 OK code: 200 - duration: 248.555666ms + duration: 35.184292ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-12","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null,"highest_role":0,"current_sign_in_ip":null,"last_sign_in_ip":null,"sign_in_count":0}' + body: '{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-13","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null,"highest_role":0,"current_sign_in_ip":null,"last_sign_in_ip":null,"sign_in_count":0}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:10:21 GMT + - Sun, 13 Oct 2024 12:28:03 GMT Etag: - - W/"46e2356788e4d5caa0216e74cc32fb89" + - W/"df1b03f2d052404f3bfbdb373ca82f49" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -123,14 +123,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS0R28C3D1PT31RJ5K5XQN","version":"1"}' + - '{"correlation_id":"01JA2XK5ZW2GCJG9SXKXPGT4EQ","version":"1"}' X-Request-Id: - - 01J9ZS0R28C3D1PT31RJ5K5XQN + - 01JA2XK5ZW2GCJG9SXKXPGT4EQ X-Runtime: - - "0.208720" + - "0.064715" status: 200 OK code: 200 - duration: 214.30075ms + duration: 67.20075ms - id: 2 request: proto: HTTP/1.1 @@ -142,7 +142,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"expires_at":"2025-10-12"}' + body: '{"expires_at":"2025-08-12"}' form: {} headers: Accept: @@ -164,7 +164,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":43,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-10-12T07:10:21.728Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2025-10-12","token":"glpat-ZF-X3ix3qmkMhKAXnF6x"}' + body: '{"id":46,"name":"Auto rotate token 1","revoked":false,"created_at":"2024-10-13T12:28:03.097Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2025-08-12","token":"glpat-Fmnvoj6H8eg7Re8TNztv"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -173,9 +173,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:10:21 GMT + - Sun, 13 Oct 2024 12:28:03 GMT Etag: - - W/"e7570a30768f2cb477d6eeb0aa2c7157" + - W/"4d284f8c8b8cff8e18635d469441a4b3" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -190,11 +190,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS0RFTQYMXAP3NW9YHZ792","version":"1"}' + - '{"correlation_id":"01JA2XK644KCGCM71XH7M7HRMS","version":"1"}' X-Request-Id: - - 01J9ZS0RFTQYMXAP3NW9YHZ792 + - 01JA2XK644KCGCM71XH7M7HRMS X-Runtime: - - "0.047269" + - "0.024732" status: 200 OK code: 200 - duration: 51.81225ms + duration: 27.712458ms diff --git a/testdata/fixtures/16.11.6/TestPathTokenRolesMultipleConfigs.yaml b/testdata/fixtures/16.11.6/TestPathTokenRolesMultipleConfigs.yaml index 91d2cc7..57d019f 100644 --- a/testdata/fixtures/16.11.6/TestPathTokenRolesMultipleConfigs.yaml +++ b/testdata/fixtures/16.11.6/TestPathTokenRolesMultipleConfigs.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":1,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:26.792Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":1,"last_used_at":"2024-10-12T19:05:53.006Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":1,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:26.792Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":1,"last_used_at":"2024-10-13T12:43:40.595Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:40 GMT Etag: - - W/"ed7206e8c7a9cef870195c3d98c08e53" + - W/"a2681e49606401ce3a486f2f48b5afd3" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AWG3QR188MTS4B5PP41V","version":"1"}' + - '{"correlation_id":"01JA2YFSMC2PQ4AM9T2KZ2C0ZS","version":"1"}' X-Request-Id: - - 01JA12AWG3QR188MTS4B5PP41V + - 01JA2YFSMC2PQ4AM9T2KZ2C0ZS X-Runtime: - - "0.038699" + - "0.045528" status: 200 OK code: 200 - duration: 47.88725ms + duration: 54.092166ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T19:05:53.088Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-13T12:38:35.438Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:40 GMT Etag: - - W/"c3ee87e2987e931f72590d1f1a4bd027" + - W/"c622b38f506045ed3c55134cf337e4f5" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -123,14 +123,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AWK1MPGR4XS63KXM5M9Z","version":"1"}' + - '{"correlation_id":"01JA2YFSQQCVGM4EYP7Q5JGZWD","version":"1"}' X-Request-Id: - - 01JA12AWK1MPGR4XS63KXM5M9Z + - 01JA2YFSQQCVGM4EYP7Q5JGZWD X-Runtime: - - "0.015030" + - "0.016065" status: 200 OK code: 200 - duration: 18.155542ms + duration: 19.878375ms - id: 2 request: proto: HTTP/1.1 @@ -162,7 +162,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T19:05:53.129Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-13T12:38:38.421Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -171,9 +171,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:40 GMT Etag: - - W/"7bd53fda9f3877943bf5bf9c30c1020f" + - W/"cc5eb58605b15a9d07c4de17559ec98c" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -188,26 +188,105 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AWM7XAENZTJV73HA4RN3","version":"1"}' + - '{"correlation_id":"01JA2YFSS1HZRQYN48KGDZXHPH","version":"1"}' X-Request-Id: - - 01JA12AWM7XAENZTJV73HA4RN3 + - 01JA2YFSS1HZRQYN48KGDZXHPH X-Runtime: - - "0.036234" + - "0.012770" status: 200 OK code: 200 - duration: 39.445625ms + duration: 15.69025ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 107 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/users?username=root + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: '[{"id":1,"username":"root","name":"Administrator","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/258d8dc916db8cea2cafb6c3cd0cb0246efe061421dbd83ec3a350428cabda4f?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/root","created_at":"2024-07-11T18:51:40.925Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":"2024-07-11T18:54:22.894Z","confirmed_at":"2024-07-11T18:51:40.831Z","last_activity_on":"2024-10-13","email":"admin@example.com","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2024-10-11T07:48:06.781Z","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@example.com","is_admin":true,"note":null,"namespace_id":1,"created_by":null,"email_reset_offered_at":null}]' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 13 Oct 2024 12:43:40 GMT + Etag: + - W/"ff413862d7bbfd875444c622c4921e00" + Link: + - ; rel="first", ; rel="last" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA2YFST3PJY4P71HZHAMSM80","version":"1"}' + X-Next-Page: + - "" + X-Page: + - "1" + X-Per-Page: + - "20" + X-Prev-Page: + - "" + X-Request-Id: + - 01JA2YFST3PJY4P71HZHAMSM80 + X-Runtime: + - "0.084888" + X-Total: + - "1" + X-Total-Pages: + - "1" + status: 200 OK + code: 200 + duration: 87.534208ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 128 transfer_encoding: [] trailer: {} host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"example-normal-example-normal-group","scopes":["api"],"access_level":10,"expires_at":"2024-10-14"}' + body: '{"name":"root-root-root-root-personal","expires_at":"2024-12-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' form: {} headers: Accept: @@ -218,7 +297,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/groups/example/access_tokens + url: http://localhost:8080/api/v4/users/1/personal_access_tokens method: POST response: proto: HTTP/1.1 @@ -226,22 +305,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 255 + content_length: 275 uncompressed: false - body: '{"id":72,"name":"example-normal-example-normal-group","revoked":false,"created_at":"2024-10-12T19:12:25.389Z","scopes":["api"],"user_id":19,"last_used_at":null,"active":true,"expires_at":"2024-10-14","access_level":10,"token":"glpat-9pTpy3YsyhiggoshfJsh"}' + body: '{"id":51,"name":"root-root-root-root-personal","revoked":false,"created_at":"2024-10-13T12:43:40.941Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":1,"last_used_at":null,"active":true,"expires_at":"2024-12-14","token":"glpat-MntUZ7te5Ef_xqsBsNkP"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "255" + - "275" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:40 GMT Etag: - - W/"b3b54fd5718a47be21869b531371df1a" + - W/"801bb4a332e474e763b05d14d269765b" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -255,15 +334,15 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AWPRFZDP2MKXJPEVZS70","version":"1"}' + - '{"correlation_id":"01JA2YFSZP6CBNZV6REZAF02AP","version":"1"}' X-Request-Id: - - 01JA12AWPRFZDP2MKXJPEVZS70 + - 01JA2YFSZP6CBNZV6REZAF02AP X-Runtime: - - "0.089114" + - "0.071790" status: 201 Created code: 201 - duration: 92.119834ms - - id: 4 + duration: 75.007333ms + - id: 5 request: proto: HTTP/1.1 proto_major: 1 @@ -289,24 +368,23 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - transfer_encoding: [] + transfer_encoding: + - chunked trailer: {} - content_length: 222 - uncompressed: false - body: '{"id":72,"name":"example-normal-example-normal-group","revoked":false,"created_at":"2024-10-12T19:12:25.389Z","scopes":["api"],"user_id":19,"last_used_at":"2024-10-12T19:12:25.516Z","active":true,"expires_at":"2024-10-14"}' + content_length: -1 + uncompressed: true + body: '{"id":51,"name":"root-root-root-root-personal","revoked":false,"created_at":"2024-10-13T12:43:40.941Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":1,"last_used_at":"2024-10-13T12:43:41.078Z","active":true,"expires_at":"2024-12-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive - Content-Length: - - "222" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Etag: - - W/"079f4ea8444710dff2cb1f7c5196effc" + - W/"298da0a0f31fe9fd40c613ce3b5ff013" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -314,21 +392,22 @@ interactions: Strict-Transport-Security: - max-age=63072000 Vary: + - Accept-Encoding - Origin X-Content-Type-Options: - nosniff X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AWWK4E0MPEY7NRYX83R6","version":"1"}' + - '{"correlation_id":"01JA2YFT4EH2GXXBQPDZ0422KW","version":"1"}' X-Request-Id: - - 01JA12AWWK4E0MPEY7NRYX83R6 + - 01JA2YFT4EH2GXXBQPDZ0422KW X-Runtime: - - "0.036049" + - "0.013352" status: 200 OK code: 200 - duration: 39.067083ms - - id: 5 + duration: 16.235708ms + - id: 6 request: proto: HTTP/1.1 proto_major: 1 @@ -348,7 +427,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/groups/example/access_tokens/72 + url: http://localhost:8080/api/v4/personal_access_tokens/51 method: DELETE response: proto: HTTP/1.1 @@ -365,7 +444,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -379,15 +458,15 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AWZ10QBH852K8PBVFXHZ","version":"1"}' + - '{"correlation_id":"01JA2YFT5F783F5XBTPV0J67GQ","version":"1"}' X-Request-Id: - - 01JA12AWZ10QBH852K8PBVFXHZ + - 01JA2YFT5F783F5XBTPV0J67GQ X-Runtime: - - "0.034073" + - "0.028244" status: 204 No Content code: 204 - duration: 37.120208ms - - id: 6 + duration: 30.500625ms + - id: 7 request: proto: HTTP/1.1 proto_major: 1 @@ -407,7 +486,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/users?username=root + url: http://localhost:8080/api/v4/users?username=normal-user method: GET response: proto: HTTP/1.1 @@ -418,7 +497,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '[{"id":1,"username":"root","name":"Administrator","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/258d8dc916db8cea2cafb6c3cd0cb0246efe061421dbd83ec3a350428cabda4f?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/root","created_at":"2024-07-11T18:51:40.925Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":"2024-10-11T07:48:06.781Z","confirmed_at":"2024-07-11T18:51:40.831Z","last_activity_on":"2024-10-12","email":"admin@example.com","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2024-10-12T18:17:51.538Z","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@example.com","is_admin":true,"note":null,"namespace_id":1,"created_by":null,"email_reset_offered_at":null}]' + body: '[{"id":3,"username":"normal-user","name":"Normal User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/30ee3a8ed91c220db688a3bde115c203763b4281374c40835f69168786a590af?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/normal-user","created_at":"2024-07-11T18:53:06.485Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:53:06.412Z","last_activity_on":"2024-10-13","email":"normal@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"normal@local","is_admin":false,"note":null,"namespace_id":3,"created_by":null,"email_reset_offered_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -427,11 +506,11 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Etag: - - W/"bf64871792e690538e2fb955f43b6737" + - W/"b764e144f065825c8e49ce5dd2ae7cfd" Link: - - ; rel="first", ; rel="last" + - ; rel="first", ; rel="last" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -446,7 +525,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AX1ENQ7RHJ6D9ZCWRADK","version":"1"}' + - '{"correlation_id":"01JA2YFT7ETZWTFB1G30G713GD","version":"1"}' X-Next-Page: - "" X-Page: @@ -456,28 +535,28 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01JA12AX1ENQ7RHJ6D9ZCWRADK + - 01JA2YFT7ETZWTFB1G30G713GD X-Runtime: - - "0.036547" + - "0.028064" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 39.040583ms - - id: 7 + duration: 31.118833ms + - id: 8 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 128 + content_length: 142 transfer_encoding: [] trailer: {} host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"root-root-root-root-personal","expires_at":"2024-10-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' + body: '{"name":"normal-user-root-normal-user-root-personal","expires_at":"2024-12-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' form: {} headers: Accept: @@ -488,7 +567,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/users/1/personal_access_tokens + url: http://localhost:8080/api/v4/users/3/personal_access_tokens method: POST response: proto: HTTP/1.1 @@ -496,22 +575,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 275 + content_length: 289 uncompressed: false - body: '{"id":73,"name":"root-root-root-root-personal","revoked":false,"created_at":"2024-10-12T19:12:25.739Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":1,"last_used_at":null,"active":true,"expires_at":"2024-10-14","token":"glpat-AKXyJZSb56y-eyxy86is"}' + body: '{"id":52,"name":"normal-user-root-normal-user-root-personal","revoked":false,"created_at":"2024-10-13T12:43:41.243Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-12-14","token":"glpat-mA7qejyEN4rHppGQzY1E"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "275" + - "289" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Etag: - - W/"859aa48da31588ac2c0e4fb03cc228b6" + - W/"26606696492e05e6e81247d59bce2361" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -525,15 +604,15 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AX3YSC82BMQMAATM8VHZ","version":"1"}' + - '{"correlation_id":"01JA2YFT9EGVVA05A2MN5QFBAG","version":"1"}' X-Request-Id: - - 01JA12AX3YSC82BMQMAATM8VHZ + - 01JA2YFT9EGVVA05A2MN5QFBAG X-Runtime: - - "0.020281" + - "0.021013" status: 201 Created code: 201 - duration: 22.479167ms - - id: 8 + duration: 23.434375ms + - id: 9 request: proto: HTTP/1.1 proto_major: 1 @@ -564,7 +643,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":73,"name":"root-root-root-root-personal","revoked":false,"created_at":"2024-10-12T19:12:25.739Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":1,"last_used_at":"2024-10-12T19:12:25.781Z","active":true,"expires_at":"2024-10-14"}' + body: '{"id":52,"name":"normal-user-root-normal-user-root-personal","revoked":false,"created_at":"2024-10-13T12:43:41.243Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":3,"last_used_at":"2024-10-13T12:43:41.286Z","active":true,"expires_at":"2024-12-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -573,9 +652,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Etag: - - W/"3d48cc5a78b8e08c23b1e842025ca239" + - W/"2c1b0be47cbc8c3a3e2eb8ef34054166" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -590,15 +669,15 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AX5CJHFTNGZH84CE9CBC","version":"1"}' + - '{"correlation_id":"01JA2YFTAYY77BCJBM0MTQMMQD","version":"1"}' X-Request-Id: - - 01JA12AX5CJHFTNGZH84CE9CBC + - 01JA2YFTAYY77BCJBM0MTQMMQD X-Runtime: - - "0.012879" + - "0.012138" status: 200 OK code: 200 - duration: 15.404042ms - - id: 9 + duration: 14.382292ms + - id: 10 request: proto: HTTP/1.1 proto_major: 1 @@ -618,7 +697,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/personal_access_tokens/73 + url: http://localhost:8080/api/v4/personal_access_tokens/52 method: DELETE response: proto: HTTP/1.1 @@ -635,7 +714,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -649,105 +728,26 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AX6DDBZFDHGF9R4R8ZG8","version":"1"}' + - '{"correlation_id":"01JA2YFTBXZJTBPAAJD0BMAK74","version":"1"}' X-Request-Id: - - 01JA12AX6DDBZFDHGF9R4R8ZG8 + - 01JA2YFTBXZJTBPAAJD0BMAK74 X-Runtime: - - "0.016645" + - "0.034234" status: 204 No Content code: 204 - duration: 19.562583ms - - id: 10 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - transfer_encoding: [] - trailer: {} - host: localhost:8080 - remote_addr: "" - request_uri: "" - body: "" - form: {} - headers: - Accept: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: http://localhost:8080/api/v4/users?username=normal-user - method: GET - response: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - transfer_encoding: - - chunked - trailer: {} - content_length: -1 - uncompressed: true - body: '[{"id":3,"username":"normal-user","name":"Normal User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/30ee3a8ed91c220db688a3bde115c203763b4281374c40835f69168786a590af?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/normal-user","created_at":"2024-07-11T18:53:06.485Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":"2024-10-12T18:37:42.685Z","confirmed_at":"2024-07-11T18:53:06.412Z","last_activity_on":"2024-10-12","email":"normal@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2024-10-12T18:37:42.685Z","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"normal@local","is_admin":false,"note":null,"namespace_id":3,"created_by":null,"email_reset_offered_at":null}]' - headers: - Cache-Control: - - max-age=0, private, must-revalidate - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 19:12:25 GMT - Etag: - - W/"55c793b0242c05c133f6f876a663f26d" - Link: - - ; rel="first", ; rel="last" - Referrer-Policy: - - strict-origin-when-cross-origin - Server: - - nginx - Strict-Transport-Security: - - max-age=63072000 - Vary: - - Accept-Encoding - - Origin - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - SAMEORIGIN - X-Gitlab-Meta: - - '{"correlation_id":"01JA12AX7N1VVFJCT8RF5EPW82","version":"1"}' - X-Next-Page: - - "" - X-Page: - - "1" - X-Per-Page: - - "20" - X-Prev-Page: - - "" - X-Request-Id: - - 01JA12AX7N1VVFJCT8RF5EPW82 - X-Runtime: - - "0.028469" - X-Total: - - "1" - X-Total-Pages: - - "1" - status: 200 OK - code: 200 - duration: 30.835417ms + duration: 36.559459ms - id: 11 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 142 + content_length: 123 transfer_encoding: [] trailer: {} host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"normal-user-root-normal-user-root-personal","expires_at":"2024-10-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' + body: '{"name":"example/example-admin-example-example-admin-project","scopes":["api"],"access_level":10,"expires_at":"2024-12-14"}' form: {} headers: Accept: @@ -758,7 +758,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/users/3/personal_access_tokens + url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens method: POST response: proto: HTTP/1.1 @@ -766,22 +766,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 289 + content_length: 270 uncompressed: false - body: '{"id":74,"name":"normal-user-root-normal-user-root-personal","revoked":false,"created_at":"2024-10-12T19:12:25.921Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-10-14","token":"glpat-FJCtKdzsUMy6kMJ3NxKs"}' + body: '{"id":53,"name":"example/example-admin-example-example-admin-project","revoked":false,"created_at":"2024-10-13T12:43:41.575Z","scopes":["api"],"user_id":9,"last_used_at":null,"active":true,"expires_at":"2024-12-14","access_level":10,"token":"glpat-FrWUFNyF4B2CN661jY7P"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "289" + - "270" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Etag: - - W/"c0ee44101ff406a8afff275b429186ee" + - W/"c2e29e7aa015f424184f0d99ecee5ee3" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -795,14 +795,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AX9NW6V427ZY71V401YG","version":"1"}' + - '{"correlation_id":"01JA2YFTE8CGGN8RERAARGQGYY","version":"1"}' X-Request-Id: - - 01JA12AX9NW6V427ZY71V401YG + - 01JA2YFTE8CGGN8RERAARGQGYY X-Runtime: - - "0.018384" + - "0.196413" status: 201 Created code: 201 - duration: 20.53525ms + duration: 199.320125ms - id: 12 request: proto: HTTP/1.1 @@ -829,23 +829,24 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - transfer_encoding: - - chunked + transfer_encoding: [] trailer: {} - content_length: -1 - uncompressed: true - body: '{"id":74,"name":"normal-user-root-normal-user-root-personal","revoked":false,"created_at":"2024-10-12T19:12:25.921Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":3,"last_used_at":"2024-10-12T19:12:25.958Z","active":true,"expires_at":"2024-10-14"}' + content_length: 237 + uncompressed: false + body: '{"id":53,"name":"example/example-admin-example-example-admin-project","revoked":false,"created_at":"2024-10-13T12:43:41.575Z","scopes":["api"],"user_id":9,"last_used_at":"2024-10-13T12:43:41.819Z","active":true,"expires_at":"2024-12-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive + Content-Length: + - "237" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Etag: - - W/"a24611f4835c20df302ce67aaa7ef210" + - W/"f75d0aea81e2726439d699b04edb6c44" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -853,21 +854,20 @@ interactions: Strict-Transport-Security: - max-age=63072000 Vary: - - Accept-Encoding - Origin X-Content-Type-Options: - nosniff X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AXAZFW8B328X6QH8RKXZ","version":"1"}' + - '{"correlation_id":"01JA2YFTTSQN55R5X3X7Q3T6K3","version":"1"}' X-Request-Id: - - 01JA12AXAZFW8B328X6QH8RKXZ + - 01JA2YFTTSQN55R5X3X7Q3T6K3 X-Runtime: - - "0.012025" + - "0.045431" status: 200 OK code: 200 - duration: 14.415375ms + duration: 50.847834ms - id: 13 request: proto: HTTP/1.1 @@ -888,7 +888,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/personal_access_tokens/74 + url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/53 method: DELETE response: proto: HTTP/1.1 @@ -905,7 +905,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 19:12:25 GMT + - Sun, 13 Oct 2024 12:43:41 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -919,26 +919,26 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AXBX96H50NH7CNP2BVGY","version":"1"}' + - '{"correlation_id":"01JA2YFTY0XC8SCA30GH8ATQZQ","version":"1"}' X-Request-Id: - - 01JA12AXBX96H50NH7CNP2BVGY + - 01JA2YFTY0XC8SCA30GH8ATQZQ X-Runtime: - - "0.015371" + - "0.072583" status: 204 No Content code: 204 - duration: 17.49875ms + duration: 75.751292ms - id: 14 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 123 + content_length: 107 transfer_encoding: [] trailer: {} host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"example/example-admin-example-example-admin-project","scopes":["api"],"access_level":10,"expires_at":"2024-10-14"}' + body: '{"name":"example-normal-example-normal-group","scopes":["api"],"access_level":10,"expires_at":"2024-12-14"}' form: {} headers: Accept: @@ -949,7 +949,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens + url: http://localhost:8080/api/v4/groups/example/access_tokens method: POST response: proto: HTTP/1.1 @@ -957,22 +957,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 271 + content_length: 255 uncompressed: false - body: '{"id":75,"name":"example/example-admin-example-example-admin-project","revoked":false,"created_at":"2024-10-12T19:12:26.112Z","scopes":["api"],"user_id":20,"last_used_at":null,"active":true,"expires_at":"2024-10-14","access_level":10,"token":"glpat-jwWmrS3Ge3qzhzszjvz3"}' + body: '{"id":54,"name":"example-normal-example-normal-group","revoked":false,"created_at":"2024-10-13T12:43:42.116Z","scopes":["api"],"user_id":10,"last_used_at":null,"active":true,"expires_at":"2024-12-14","access_level":10,"token":"glpat-qgb9kqvkzoHKdXcYxkRr"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "271" + - "255" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:26 GMT + - Sun, 13 Oct 2024 12:43:42 GMT Etag: - - W/"b382b8ab3f856dd3763fcd39011f6f3b" + - W/"57031c31769a9d05c4f1623e3c9cf89a" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -986,14 +986,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AXD3NQ1JYB4NDS2E014T","version":"1"}' + - '{"correlation_id":"01JA2YFV2S2ZD98XYCH77DNG1V","version":"1"}' X-Request-Id: - - 01JA12AXD3NQ1JYB4NDS2E014T + - 01JA2YFV2S2ZD98XYCH77DNG1V X-Runtime: - - "0.097230" + - "0.078965" status: 201 Created code: 201 - duration: 99.548583ms + duration: 81.8985ms - id: 15 request: proto: HTTP/1.1 @@ -1022,22 +1022,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 238 + content_length: 222 uncompressed: false - body: '{"id":75,"name":"example/example-admin-example-example-admin-project","revoked":false,"created_at":"2024-10-12T19:12:26.112Z","scopes":["api"],"user_id":20,"last_used_at":"2024-10-12T19:12:26.231Z","active":true,"expires_at":"2024-10-14"}' + body: '{"id":54,"name":"example-normal-example-normal-group","revoked":false,"created_at":"2024-10-13T12:43:42.116Z","scopes":["api"],"user_id":10,"last_used_at":"2024-10-13T12:43:42.215Z","active":true,"expires_at":"2024-12-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "238" + - "222" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 19:12:26 GMT + - Sun, 13 Oct 2024 12:43:42 GMT Etag: - - W/"9654a9ca4ab123bf74b194cebcf1bd4b" + - W/"17a871b105c966d8372c214bd3f98bdd" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -1051,14 +1051,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AXKD2JPC710Y2MCZ2JVH","version":"1"}' + - '{"correlation_id":"01JA2YFV7YTK5430JNCXN3ZM35","version":"1"}' X-Request-Id: - - 01JA12AXKD2JPC710Y2MCZ2JVH + - 01JA2YFV7YTK5430JNCXN3ZM35 X-Runtime: - - "0.021420" + - "0.054073" status: 200 OK code: 200 - duration: 24.396958ms + duration: 56.774916ms - id: 16 request: proto: HTTP/1.1 @@ -1079,7 +1079,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/75 + url: http://localhost:8080/api/v4/groups/example/access_tokens/54 method: DELETE response: proto: HTTP/1.1 @@ -1096,7 +1096,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 19:12:26 GMT + - Sun, 13 Oct 2024 12:43:42 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -1110,11 +1110,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01JA12AXMZ53AKZ2WD191TTJHR","version":"1"}' + - '{"correlation_id":"01JA2YFVBH891EKBC0FNA0TX5R","version":"1"}' X-Request-Id: - - 01JA12AXMZ53AKZ2WD191TTJHR + - 01JA2YFVBH891EKBC0FNA0TX5R X-Runtime: - - "0.032242" + - "0.082464" status: 204 No Content code: 204 - duration: 34.72825ms + duration: 85.187667ms diff --git a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml index d916534..1dfb188 100644 --- a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml +++ b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:08:01.710Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-13T12:38:35.438Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:01 GMT + - Sun, 13 Oct 2024 12:38:35 GMT Etag: - - W/"5defe635c9d71d60f6df25bf5fd948f3" + - W/"c622b38f506045ed3c55134cf337e4f5" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWFQP3X3BYWJMPYZDEFPA","version":"1"}' + - '{"correlation_id":"01JA2Y6FMT3DA19DP7WD81X12Z","version":"1"}' X-Request-Id: - - 01J9ZRWFQP3X3BYWJMPYZDEFPA + - 01JA2Y6FMT3DA19DP7WD81X12Z X-Runtime: - - "0.157427" + - "0.024871" status: 200 OK code: 200 - duration: 170.138958ms + duration: 40.17025ms - id: 1 request: proto: HTTP/1.1 @@ -106,7 +106,7 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:02 GMT + - Sun, 13 Oct 2024 12:38:35 GMT Etag: - W/"25fe2b64ac6604f6b3a8740f4910a720" Link: @@ -125,7 +125,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWG2AJRP09Y4BZWS59KJJ","version":"1"}' + - '{"correlation_id":"01JA2Y6FQ6BRW7H2AB5S2YFQZY","version":"1"}' X-Next-Page: - "" X-Page: @@ -135,16 +135,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9ZRWG2AJRP09Y4BZWS59KJJ + - 01JA2Y6FQ6BRW7H2AB5S2YFQZY X-Runtime: - - "0.268702" + - "0.139844" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 272.622416ms + duration: 143.049958ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"personal","expires_at":"2024-10-18","scopes":["read_api"]}' + body: '{"name":"personal","expires_at":"2024-12-18","scopes":["read_api"]}' form: {} headers: Accept: @@ -177,7 +177,7 @@ interactions: trailer: {} content_length: 214 uncompressed: false - body: '{"id":60,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:02.667Z","scopes":["read_api"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-10-18","token":"glpat-qA4C1LRq38HbvP7z7Y_K"}' + body: '{"id":47,"name":"personal","revoked":false,"created_at":"2024-10-13T12:38:35.818Z","scopes":["read_api"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-12-18","token":"glpat-3VQyeQny-yjY66axCsyk"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -188,9 +188,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:02 GMT + - Sun, 13 Oct 2024 12:38:35 GMT Etag: - - W/"a344d2fc8c42eb292649713f44a19757" + - W/"b259fff8a9804777b4d61073ade6e6b7" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -204,14 +204,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWGKEJX4VPX3GJ9PTFPKN","version":"1"}' + - '{"correlation_id":"01JA2Y6G0764DS3ACJTDGSPBHB","version":"1"}' X-Request-Id: - - 01J9ZRWGKEJX4VPX3GJ9PTFPKN + - 01JA2Y6G0764DS3ACJTDGSPBHB X-Runtime: - - "0.191464" + - "0.092377" status: 201 Created code: 201 - duration: 195.074583ms + duration: 96.453667ms - id: 3 request: proto: HTTP/1.1 @@ -242,7 +242,7 @@ interactions: trailer: {} content_length: 199 uncompressed: false - body: '{"id":60,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:02.667Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-12T07:08:02.965Z","active":true,"expires_at":"2024-10-18"}' + body: '{"id":47,"name":"personal","revoked":false,"created_at":"2024-10-13T12:38:35.818Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-13T12:38:36.000Z","active":true,"expires_at":"2024-12-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -253,9 +253,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:36 GMT Etag: - - W/"7593a1f970623775e0a29ef779ecf0ff" + - W/"39798d8e52838dc7d10463d90baef51b" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -269,14 +269,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWGZRGWGSKS2DYGX1PR0M","version":"1"}' + - '{"correlation_id":"01JA2Y6G69D2Q1469WNAF82178","version":"1"}' X-Request-Id: - - 01J9ZRWGZRGWGSKS2DYGX1PR0M + - 01JA2Y6G69D2Q1469WNAF82178 X-Runtime: - - "0.065304" + - "0.042050" status: 200 OK code: 200 - duration: 68.96675ms + duration: 45.029125ms - id: 4 request: proto: HTTP/1.1 @@ -307,7 +307,7 @@ interactions: trailer: {} content_length: 199 uncompressed: false - body: '{"id":60,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:02.667Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-12T07:08:02.965Z","active":true,"expires_at":"2024-10-18"}' + body: '{"id":47,"name":"personal","revoked":false,"created_at":"2024-10-13T12:38:35.818Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-13T12:38:36.000Z","active":true,"expires_at":"2024-12-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -318,9 +318,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:36 GMT Etag: - - W/"7593a1f970623775e0a29ef779ecf0ff" + - W/"39798d8e52838dc7d10463d90baef51b" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -334,11 +334,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWH45S1GWK3NZPPYNYCB5","version":"1"}' + - '{"correlation_id":"01JA2Y6G944GS8Z0KTD0WS3YF2","version":"1"}' X-Request-Id: - - 01J9ZRWH45S1GWK3NZPPYNYCB5 + - 01JA2Y6G944GS8Z0KTD0WS3YF2 X-Runtime: - - "0.012113" + - "0.009559" status: 200 OK code: 200 - duration: 14.934875ms + duration: 11.812ms diff --git a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml index 2530941..5fd6273 100644 --- a/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml +++ b/testdata/fixtures/16.11.6/TestWithAdminUser_PAT_AdminUser_VaultRevokesToken.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:08:01.710Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":2,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:53:46.924Z","scopes":["api","read_api","read_user","sudo","admin_mode","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":2,"last_used_at":"2024-10-13T12:38:35.438Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:36 GMT Etag: - - W/"5defe635c9d71d60f6df25bf5fd948f3" + - W/"c622b38f506045ed3c55134cf337e4f5" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWH5HYTYEXMVV2PZR8GK5","version":"1"}' + - '{"correlation_id":"01JA2Y6H526BKNRXMVDVZKJM9T","version":"1"}' X-Request-Id: - - 01J9ZRWH5HYTYEXMVV2PZR8GK5 + - 01JA2Y6H526BKNRXMVDVZKJM9T X-Runtime: - - "0.012560" + - "0.023543" status: 200 OK code: 200 - duration: 15.24425ms + duration: 48.414833ms - id: 1 request: proto: HTTP/1.1 @@ -97,7 +97,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '[{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-12","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null}]' + body: '[{"id":2,"username":"admin-user","name":"Admin User","state":"active","locked":false,"avatar_url":"https://www.gravatar.com/avatar/af0325f5b5bc22760340e6e28bbe467949a83cf3a620329417c7718f89e0f7c5?s=80\u0026d=identicon","web_url":"http://1b25ef517b98/admin-user","created_at":"2024-07-11T18:52:45.504Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-07-11T18:52:45.443Z","last_activity_on":"2024-10-13","email":"admin@local","theme_id":3,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":null,"identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":false,"commit_email":"admin@local","is_admin":true,"note":null,"namespace_id":2,"created_by":null,"email_reset_offered_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:37 GMT Etag: - - W/"4f7bac1106e5f7fb8072db43e1305b0b" + - W/"e529ce72b73a5e0dbc8ccbc4e988e4e1" Link: - ; rel="first", ; rel="last" Referrer-Policy: @@ -125,7 +125,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWH6JP7VCAPYVVRACS7NB","version":"1"}' + - '{"correlation_id":"01JA2Y6H7RBSGEY53ZRFEJ7PQW","version":"1"}' X-Next-Page: - "" X-Page: @@ -135,16 +135,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9ZRWH6JP7VCAPYVVRACS7NB + - 01JA2Y6H7RBSGEY53ZRFEJ7PQW X-Runtime: - - "0.127098" + - "0.034805" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 130.0885ms + duration: 38.105167ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"personal","expires_at":"2024-10-13","scopes":["read_api"]}' + body: '{"name":"personal","expires_at":"2024-12-13","scopes":["read_api"]}' form: {} headers: Accept: @@ -177,7 +177,7 @@ interactions: trailer: {} content_length: 214 uncompressed: false - body: '{"id":61,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:03.456Z","scopes":["read_api"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2024-10-13","token":"glpat-JxBosQLxKgsQ-B1CMqqB"}' + body: '{"id":48,"name":"personal","revoked":false,"created_at":"2024-10-13T12:38:37.169Z","scopes":["read_api"],"user_id":2,"last_used_at":null,"active":true,"expires_at":"2024-12-13","token":"glpat-dbiw9ZtysyNAqtLpz5uk"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -188,9 +188,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:37 GMT Etag: - - W/"b65e9b2b3e0f44d796e2e5d39133cdc8" + - W/"ad78461aabd4ab95e7878dd51b1b2e64" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -204,14 +204,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWHEV27KGA9FGH5TP7CEQ","version":"1"}' + - '{"correlation_id":"01JA2Y6HA7CWC14EQKXCFK1V2F","version":"1"}' X-Request-Id: - - 01J9ZRWHEV27KGA9FGH5TP7CEQ + - 01JA2Y6HA7CWC14EQKXCFK1V2F X-Runtime: - - "0.044625" + - "0.092150" status: 201 Created code: 201 - duration: 49.055291ms + duration: 95.854417ms - id: 3 request: proto: HTTP/1.1 @@ -242,7 +242,7 @@ interactions: trailer: {} content_length: 199 uncompressed: false - body: '{"id":61,"name":"personal","revoked":false,"created_at":"2024-10-12T07:08:03.456Z","scopes":["read_api"],"user_id":2,"last_used_at":"2024-10-12T07:08:03.529Z","active":true,"expires_at":"2024-10-13"}' + body: '{"id":48,"name":"personal","revoked":false,"created_at":"2024-10-13T12:38:37.169Z","scopes":["read_api"],"user_id":2,"last_used_at":"2024-10-13T12:38:37.329Z","active":true,"expires_at":"2024-12-13"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -253,9 +253,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:37 GMT Etag: - - W/"f38e2aa37082adf08598ce78aaacdeb1" + - W/"f0659239028c1b41e0d6c12806348951" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -269,14 +269,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWHJ0ZQVW4J3M1D0E3PAE","version":"1"}' + - '{"correlation_id":"01JA2Y6HG84VBH5HX7FCHP8BJ1","version":"1"}' X-Request-Id: - - 01J9ZRWHJ0ZQVW4J3M1D0E3PAE + - 01JA2Y6HG84VBH5HX7FCHP8BJ1 X-Runtime: - - "0.018336" + - "0.013696" status: 200 OK code: 200 - duration: 21.143333ms + duration: 16.850541ms - id: 4 request: proto: HTTP/1.1 @@ -297,7 +297,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/personal_access_tokens/61 + url: http://localhost:8080/api/v4/personal_access_tokens/48 method: DELETE response: proto: HTTP/1.1 @@ -314,7 +314,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:37 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -328,14 +328,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWHKBT344N6ST85SD6XKY","version":"1"}' + - '{"correlation_id":"01JA2Y6HHASFMMRWNB5PKCAW6P","version":"1"}' X-Request-Id: - - 01J9ZRWHKBT344N6ST85SD6XKY + - 01JA2Y6HHASFMMRWNB5PKCAW6P X-Runtime: - - "0.071987" + - "0.054394" status: 204 No Content code: 204 - duration: 74.618333ms + duration: 57.000542ms - id: 5 request: proto: HTTP/1.1 @@ -377,7 +377,7 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:03 GMT + - Sun, 13 Oct 2024 12:38:37 GMT Server: - nginx Vary: @@ -385,11 +385,11 @@ interactions: Www-Authenticate: - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWHR25J0WGGQ3JTX4PZSQ","version":"1"}' + - '{"correlation_id":"01JA2Y6HMYBVZSNNFHABRTHYF4","version":"1"}' X-Request-Id: - - 01J9ZRWHR25J0WGGQ3JTX4PZSQ + - 01JA2Y6HMYBVZSNNFHABRTHYF4 X-Runtime: - - "0.011782" + - "0.024553" status: 401 Unauthorized code: 401 - duration: 14.681125ms + duration: 27.516416ms diff --git a/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml b/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml deleted file mode 100644 index 8078185..0000000 --- a/testdata/fixtures/16.11.6/TestWithGitlabUser_RotateToken.yaml +++ /dev/null @@ -1,467 +0,0 @@ ---- -version: 2 -interactions: - - id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - transfer_encoding: [] - trailer: {} - host: gitlab.com - remote_addr: "" - request_uri: "" - body: "" - form: {} - headers: - Accept: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: https://gitlab.com/api/v4/personal_access_tokens/self - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true - body: '{"id":10926727,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:11:02.977Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-12T07:12:00.639Z","active":true,"expires_at":"2024-11-11"}' - headers: - Cache-Control: - - max-age=0, private, must-revalidate - Cf-Cache-Status: - - MISS - Cf-Ray: - - 8d15477379e51e9d-AMS - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 07:12:00 GMT - Etag: - - W/"eb8c6a58e7ef9a81455d40394cc921c0" - Gitlab-Lb: - - haproxy-main-47-lb-gprd - Gitlab-Sv: - - api-gke-us-east1-d - Nel: - - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' - Referrer-Policy: - - strict-origin-when-cross-origin - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=QwHC6%2BGYltSi32LYuov%2FPCQBqfhW4S4CtOe%2Bfgesbqk%2FMVjhWm39TBL2YEdc1X26a2ZAzdmu09McaeKtWbjJTHqCZc8u%2B%2BmK0O0kTlzWz%2Fl2YHa7qPFd5ERLpYs%3D"}],"group":"cf-nel","max_age":604800}' - Server: - - cloudflare - Set-Cookie: - - _cfuvid=pps4bgezwihp4YSkJ1i31CEuwqAOlR3JsVBLZBV92Qc-1728717120727-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Origin, Accept-Encoding - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - SAMEORIGIN - X-Gitlab-Meta: - - '{"correlation_id":"d9f31ea160d5a3b1437c1ed361036332","version":"1"}' - X-Request-Id: - - d9f31ea160d5a3b1437c1ed361036332 - X-Runtime: - - "0.034907" - status: 200 OK - code: 200 - duration: 246.743792ms - - id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - transfer_encoding: [] - trailer: {} - host: gitlab.com - remote_addr: "" - request_uri: "" - body: "" - form: {} - headers: - Accept: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: https://gitlab.com/api/v4/personal_access_tokens/self - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true - body: '{"id":10926727,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:11:02.977Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-12T07:12:00.639Z","active":true,"expires_at":"2024-11-11"}' - headers: - Cache-Control: - - max-age=0, private, must-revalidate - Cf-Cache-Status: - - MISS - Cf-Ray: - - 8d1547763b7a1e9d-AMS - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 07:12:01 GMT - Etag: - - W/"eb8c6a58e7ef9a81455d40394cc921c0" - Gitlab-Lb: - - haproxy-main-50-lb-gprd - Gitlab-Sv: - - gke-cny-api - Nel: - - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' - Referrer-Policy: - - strict-origin-when-cross-origin - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=5xjXLYIMD%2FnsXioaH5biNyn9S%2FOaANmsSAnbo%2FZnr1%2F9alVCTaXvj1qKOFV1Y3tnt%2BHLhZMjnxT8UqEefm8r3B4u9H8cvEud0j3itXFYNy7n0JXsM3mOAY3K5uI%3D"}],"group":"cf-nel","max_age":604800}' - Server: - - cloudflare - Set-Cookie: - - _cfuvid=y00OhfNJsPq_nK80esK8keTOe9voQEp5sIurFuxzMDw-1728717121151-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Origin, Accept-Encoding - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - SAMEORIGIN - X-Gitlab-Meta: - - '{"correlation_id":"15633d6b4e57e547a32bc534ceb06607","version":"1"}' - X-Request-Id: - - 15633d6b4e57e547a32bc534ceb06607 - X-Runtime: - - "0.026121" - status: 200 OK - code: 200 - duration: 177.210708ms - - id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - transfer_encoding: [] - trailer: {} - host: gitlab.com - remote_addr: "" - request_uri: "" - body: "" - form: {} - headers: - Accept: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: https://gitlab.com/api/v4/users/32923 - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true - body: '{"id":32923,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://gitlab.com/ilijamt","created_at":"2014-05-19T14:51:54.441Z","bio":"","location":"","public_email":"","skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":false,"work_information":null,"local_time":"7:12 AM"}' - headers: - Cache-Control: - - max-age=0, private, must-revalidate - Cf-Cache-Status: - - MISS - Cf-Ray: - - 8d1547786c661e9d-AMS - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 07:12:01 GMT - Etag: - - W/"6be37df22a2eca9ad06347f5e193f804" - Gitlab-Lb: - - haproxy-main-54-lb-gprd - Gitlab-Sv: - - api-gke-us-east1-b - Nel: - - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' - Referrer-Policy: - - strict-origin-when-cross-origin - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=nqNLGU098cNhDE%2FiYNzVCt4hxBSfIkUD72bdx1MHvzLeJHVHIpw4DQwoFPkoFcUaRZWRQyFVvCCOJvKhiP90DiLYQUl46kTyldC%2FmDGciZqJtLE1WGEsrt76B4k%3D"}],"group":"cf-nel","max_age":604800}' - Server: - - cloudflare - Set-Cookie: - - _cfuvid=V_4IV2SZQNSF8n4tb85_gISISbsoKQ2ajNVAgGjsjSI-1728717121547-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Origin, Accept-Encoding - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - SAMEORIGIN - X-Gitlab-Meta: - - '{"correlation_id":"876d805e1a60a6e6fbb3ecc18db599e7","version":"1"}' - X-Request-Id: - - 876d805e1a60a6e6fbb3ecc18db599e7 - X-Runtime: - - "0.069151" - status: 200 OK - code: 200 - duration: 213.577417ms - - id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 27 - transfer_encoding: [] - trailer: {} - host: gitlab.com - remote_addr: "" - request_uri: "" - body: '{"expires_at":"2024-11-12"}' - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: https://gitlab.com/api/v4/personal_access_tokens/10926727/rotate - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true - body: '{"id":10926736,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:01.911Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":null,"active":true,"expires_at":"2024-11-12","token":"glpat-nsMtXz-LoSz8ib4MznxH"}' - headers: - Cache-Control: - - max-age=0, private, must-revalidate - Cf-Cache-Status: - - DYNAMIC - Cf-Ray: - - 8d15477b1ddf1e9d-AMS - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 07:12:01 GMT - Etag: - - W/"5eeae513145d150baf0cd54bcc1bd6b4" - Gitlab-Lb: - - haproxy-main-38-lb-gprd - Gitlab-Sv: - - api-gke-us-east1-d - Nel: - - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' - Referrer-Policy: - - strict-origin-when-cross-origin - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=2eRkbx6QQMSpElFGuVqxmXWwgumech4hZL5QID34wgPn%2FbFqbZVjuvc7Xp%2F3LOBCnUFH4%2Brp9G7Zt%2B9h4d8I%2FmfSlOlJrH4B%2BV4sLhJK%2B7UEsEIBD1FTckO0VuY%3D"}],"group":"cf-nel","max_age":604800}' - Server: - - cloudflare - Set-Cookie: - - _cfuvid=ivD7yco6cZcE.EGCu.9Jt.jnFaLF1h_fl6eoVxpFTfk-1728717121978-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Origin - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - SAMEORIGIN - X-Gitlab-Meta: - - '{"correlation_id":"70b685b07efe479e22cd7fe28cf0c1f3","version":"1"}' - X-Request-Id: - - 70b685b07efe479e22cd7fe28cf0c1f3 - X-Runtime: - - "0.074974" - status: 200 OK - code: 200 - duration: 312.304167ms - - id: 4 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - transfer_encoding: [] - trailer: {} - host: gitlab.com - remote_addr: "" - request_uri: "" - body: "" - form: {} - headers: - Accept: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: https://gitlab.com/api/v4/personal_access_tokens/self - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: 106 - uncompressed: false - body: '{"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}' - headers: - Cache-Control: - - no-cache - Cf-Cache-Status: - - MISS - Cf-Ray: - - 8d15477f0ff21e9d-AMS - Content-Length: - - "106" - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 07:12:02 GMT - Gitlab-Lb: - - haproxy-main-22-lb-gprd - Gitlab-Sv: - - api-gke-us-east1-c - Nel: - - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' - Referrer-Policy: - - strict-origin-when-cross-origin - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=n%2BJPY1qsMeUIr9kcb4Kouox3f1Z%2BH%2FFlfb5htBPGIUAKSyNAmm7ueeF0qxYsbf7ZpFxKEsaWIaCfjFXgW3CnEoNS%2BsDhy2jMZFLCBtPxlADzfcCQZhdC1Xz%2FsD0%3D"}],"group":"cf-nel","max_age":604800}' - Server: - - cloudflare - Set-Cookie: - - _cfuvid=4HBEOLX3hywL2WBLYcnArTHE8F9eAC4VBoSB4y938dA-1728717122561-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Origin, Accept-Encoding - Www-Authenticate: - - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." - X-Content-Type-Options: - - nosniff - X-Gitlab-Meta: - - '{"correlation_id":"36989736767ccf36f9e086e7cf2a65a2","version":"1"}' - X-Request-Id: - - 36989736767ccf36f9e086e7cf2a65a2 - X-Runtime: - - "0.022621" - status: 401 Unauthorized - code: 401 - duration: 170.916583ms - - id: 5 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - transfer_encoding: [] - trailer: {} - host: gitlab.com - remote_addr: "" - request_uri: "" - body: "" - form: {} - headers: - Accept: - - application/json - Private-Token: - - REPLACED-TOKEN - User-Agent: - - go-gitlab - url: https://gitlab.com/api/v4/personal_access_tokens/self - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true - body: '{"id":10926736,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:01.911Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features"],"user_id":32923,"last_used_at":"2024-10-12T07:12:02.826Z","active":true,"expires_at":"2024-11-12"}' - headers: - Cache-Control: - - max-age=0, private, must-revalidate - Cf-Cache-Status: - - MISS - Cf-Ray: - - 8d15478128da1e9d-AMS - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Date: - - Sat, 12 Oct 2024 07:12:02 GMT - Etag: - - W/"d13226ad8c7d864b97d95937b0bf4611" - Gitlab-Lb: - - haproxy-main-47-lb-gprd - Gitlab-Sv: - - api-gke-us-east1-d - Nel: - - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' - Referrer-Policy: - - strict-origin-when-cross-origin - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=tT9kCcJjesQcb42wGjvYCybpQMn6mA3TqY8pFYzK7VsrQIdpYxwop8V3e1VxBQrqNnvX6ydvtsV9qnTTSxc%2Bgg1M%2F4JBzZRsxAnRgJ5iX%2F9NsHWE02L2bsHObA8%3D"}],"group":"cf-nel","max_age":604800}' - Server: - - cloudflare - Set-Cookie: - - _cfuvid=7b2mxUIJsK7r6yeW_Yyms1m3c.yU4TPg0FaPJGuEzHw-1728717122945-0.0.1.1-604800000; path=/; domain=.gitlab.com; HttpOnly; Secure; SameSite=None - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Origin, Accept-Encoding - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - SAMEORIGIN - X-Gitlab-Meta: - - '{"correlation_id":"7093da2c7f24e5300693c6432453c083","version":"1"}' - X-Request-Id: - - 7093da2c7f24e5300693c6432453c083 - X-Runtime: - - "0.064506" - status: 200 OK - code: 200 - duration: 210.568084ms diff --git a/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml b/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml index 39c55bb..14de79e 100644 --- a/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml +++ b/testdata/fixtures/16.11.6/TestWithNormalUser_GAT.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T07:08:04.484Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-13T12:38:38.421Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:41 GMT + - Sun, 13 Oct 2024 12:38:38 GMT Etag: - - W/"882521c09243ae1cedf2ba0b451a8b14" + - W/"cc5eb58605b15a9d07c4de17559ec98c" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXPRZ0V9XVJNXEPKD07Q2","version":"1"}' + - '{"correlation_id":"01JA2Y6JJ60F16H4ZNDGPNP9ZY","version":"1"}' X-Request-Id: - - 01J9ZRXPRZ0V9XVJNXEPKD07Q2 + - 01JA2Y6JJ60F16H4ZNDGPNP9ZY X-Runtime: - - "0.014012" + - "0.019465" status: 200 OK code: 200 - duration: 19.567458ms + duration: 44.66725ms - id: 1 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"gat-token","scopes":["read_api"],"access_level":40,"expires_at":"2024-10-18"}' + body: '{"name":"gat-token","scopes":["read_api"],"access_level":40,"expires_at":"2024-12-18"}' form: {} headers: Accept: @@ -96,22 +96,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 234 + content_length: 233 uncompressed: false - body: '{"id":62,"name":"gat-token","revoked":false,"created_at":"2024-10-12T07:08:41.897Z","scopes":["read_api"],"user_id":17,"last_used_at":null,"active":true,"expires_at":"2024-10-18","access_level":40,"token":"glpat-Qvtx2op9HeVJiLMrWP-2"}' + body: '{"id":49,"name":"gat-token","revoked":false,"created_at":"2024-10-13T12:38:38.585Z","scopes":["read_api"],"user_id":7,"last_used_at":null,"active":true,"expires_at":"2024-12-18","access_level":40,"token":"glpat-wiMwr3AFrfqfN2dyir7z"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "234" + - "233" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:41 GMT + - Sun, 13 Oct 2024 12:38:38 GMT Etag: - - W/"cde6de0a1f38d63242148ca51f3ab446" + - W/"5720f864fd167bc12d876edd8d614b73" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -125,14 +125,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXPT8CPKE6PJB88YSGBDD","version":"1"}' + - '{"correlation_id":"01JA2Y6JMMTDEW5Y26NNFC7WM4","version":"1"}' X-Request-Id: - - 01J9ZRXPT8CPKE6PJB88YSGBDD + - 01JA2Y6JMMTDEW5Y26NNFC7WM4 X-Runtime: - - "0.230218" + - "0.105643" status: 201 Created code: 201 - duration: 233.492042ms + duration: 109.132416ms - id: 2 request: proto: HTTP/1.1 @@ -161,22 +161,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 201 + content_length: 200 uncompressed: false - body: '{"id":62,"name":"gat-token","revoked":false,"created_at":"2024-10-12T07:08:41.897Z","scopes":["read_api"],"user_id":17,"last_used_at":"2024-10-12T07:08:42.186Z","active":true,"expires_at":"2024-10-18"}' + body: '{"id":49,"name":"gat-token","revoked":false,"created_at":"2024-10-13T12:38:38.585Z","scopes":["read_api"],"user_id":7,"last_used_at":"2024-10-13T12:38:38.714Z","active":true,"expires_at":"2024-12-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "201" + - "200" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:42 GMT + - Sun, 13 Oct 2024 12:38:38 GMT Etag: - - W/"b67876e7daf49e13b5af88d175613fe8" + - W/"ac85a3dcf7d61d2634cfaf44e35c6a59" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -190,14 +190,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXQ8ZHVYMFPDMVZQQHW4F","version":"1"}' + - '{"correlation_id":"01JA2Y6JVGEC8THB5GBRCKHC75","version":"1"}' X-Request-Id: - - 01J9ZRXQ8ZHVYMFPDMVZQQHW4F + - 01JA2Y6JVGEC8THB5GBRCKHC75 X-Runtime: - - "0.052851" + - "0.020109" status: 200 OK code: 200 - duration: 60.288375ms + duration: 23.452708ms - id: 3 request: proto: HTTP/1.1 @@ -218,7 +218,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/groups/example/access_tokens/62 + url: http://localhost:8080/api/v4/groups/example/access_tokens/49 method: DELETE response: proto: HTTP/1.1 @@ -235,7 +235,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 07:08:42 GMT + - Sun, 13 Oct 2024 12:38:38 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -249,14 +249,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXQCSPJ8QHST1PA6QS2BX","version":"1"}' + - '{"correlation_id":"01JA2Y6JX19RTKW65YBJ4V6NE2","version":"1"}' X-Request-Id: - - 01J9ZRXQCSPJ8QHST1PA6QS2BX + - 01JA2Y6JX19RTKW65YBJ4V6NE2 X-Runtime: - - "0.143387" + - "0.073216" status: 204 No Content code: 204 - duration: 147.257708ms + duration: 76.216667ms - id: 4 request: proto: HTTP/1.1 @@ -298,7 +298,7 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:42 GMT + - Sun, 13 Oct 2024 12:38:38 GMT Server: - nginx Vary: @@ -306,11 +306,11 @@ interactions: Www-Authenticate: - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXQP3FYF8GNV1CAE2XHPJ","version":"1"}' + - '{"correlation_id":"01JA2Y6K1SWDK0WKWB2Z81DH4T","version":"1"}' X-Request-Id: - - 01J9ZRXQP3FYF8GNV1CAE2XHPJ + - 01JA2Y6K1SWDK0WKWB2Z81DH4T X-Runtime: - - "0.010340" + - "0.008422" status: 401 Unauthorized code: 401 - duration: 14.14625ms + duration: 11.261667ms diff --git a/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml b/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml index ea6b997..652971b 100644 --- a/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml +++ b/testdata/fixtures/16.11.6/TestWithNormalUser_PersonalAT_Fails.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T07:08:04.484Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-13T12:38:38.421Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:04 GMT + - Sun, 13 Oct 2024 12:38:39 GMT Etag: - - W/"882521c09243ae1cedf2ba0b451a8b14" + - W/"cc5eb58605b15a9d07c4de17559ec98c" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWJEJKR0VG4DNRYZ9D9HJ","version":"1"}' + - '{"correlation_id":"01JA2Y6KXPT9DDQTHS0P97ZW6R","version":"1"}' X-Request-Id: - - 01J9ZRWJEJKR0VG4DNRYZ9D9HJ + - 01JA2Y6KXPT9DDQTHS0P97ZW6R X-Runtime: - - "0.060524" + - "0.031431" status: 200 OK code: 200 - duration: 68.569125ms + duration: 41.503625ms - id: 1 request: proto: HTTP/1.1 @@ -106,7 +106,7 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:04 GMT + - Sun, 13 Oct 2024 12:38:39 GMT Etag: - W/"8e47761c8cfb2481e9983f2bd4b37cca" Link: @@ -125,7 +125,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWJJZMR4XKQ8G48D2QXCM","version":"1"}' + - '{"correlation_id":"01JA2Y6M0782M70WYC4FDZENSA","version":"1"}' X-Next-Page: - "" X-Page: @@ -135,16 +135,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9ZRWJJZMR4XKQ8G48D2QXCM + - 01JA2Y6M0782M70WYC4FDZENSA X-Runtime: - - "0.023643" + - "0.108940" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 27.55125ms + duration: 112.581917ms - id: 2 request: proto: HTTP/1.1 @@ -156,7 +156,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"personal","expires_at":"2024-10-18","scopes":["read_api"]}' + body: '{"name":"personal","expires_at":"2024-12-18","scopes":["read_api"]}' form: {} headers: Accept: @@ -188,7 +188,7 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:04 GMT + - Sun, 13 Oct 2024 12:38:40 GMT Server: - nginx Vary: @@ -198,11 +198,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRWJMRH7TY32E38BP1WQRM","version":"1"}' + - '{"correlation_id":"01JA2Y6M7BXM6P5X757132A299","version":"1"}' X-Request-Id: - - 01J9ZRWJMRH7TY32E38BP1WQRM + - 01JA2Y6M7BXM6P5X757132A299 X-Runtime: - - "0.017483" + - "0.019930" status: 403 Forbidden code: 403 - duration: 20.619208ms + duration: 24.000625ms diff --git a/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml b/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml index 4ff30f5..bf1aab8 100644 --- a/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml +++ b/testdata/fixtures/16.11.6/TestWithNormalUser_ProjectAT.yaml @@ -32,7 +32,7 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-12T07:08:04.484Z","active":true,"expires_at":"2025-07-11"}' + body: '{"id":3,"name":"Initial token","revoked":false,"created_at":"2024-07-11T18:54:07.334Z","scopes":["api","read_api","read_user","create_runner","k8s_proxy","read_repository","write_repository","ai_features","read_service_ping"],"user_id":3,"last_used_at":"2024-10-13T12:38:38.421Z","active":true,"expires_at":"2025-07-11"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -41,9 +41,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:42 GMT + - Sun, 13 Oct 2024 12:38:41 GMT Etag: - - W/"882521c09243ae1cedf2ba0b451a8b14" + - W/"cc5eb58605b15a9d07c4de17559ec98c" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -58,14 +58,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXQVFJYTFYY01JCWYP5X7","version":"1"}' + - '{"correlation_id":"01JA2Y6N3W8Y4D6V0DV98D0Y57","version":"1"}' X-Request-Id: - - 01J9ZRXQVFJYTFYY01JCWYP5X7 + - 01JA2Y6N3W8Y4D6V0DV98D0Y57 X-Runtime: - - "0.026300" + - "0.016143" status: 200 OK code: 200 - duration: 33.345416ms + duration: 22.111125ms - id: 1 request: proto: HTTP/1.1 @@ -77,7 +77,7 @@ interactions: host: localhost:8080 remote_addr: "" request_uri: "" - body: '{"name":"project","scopes":["read_api"],"access_level":40,"expires_at":"2024-10-18"}' + body: '{"name":"project","scopes":["read_api"],"access_level":40,"expires_at":"2024-12-18"}' form: {} headers: Accept: @@ -96,22 +96,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 232 + content_length: 231 uncompressed: false - body: '{"id":63,"name":"project","revoked":false,"created_at":"2024-10-12T07:08:42.946Z","scopes":["read_api"],"user_id":18,"last_used_at":null,"active":true,"expires_at":"2024-10-18","access_level":40,"token":"glpat-hDkAkz92N48vi8n2sxy-"}' + body: '{"id":50,"name":"project","revoked":false,"created_at":"2024-10-13T12:38:41.278Z","scopes":["read_api"],"user_id":8,"last_used_at":null,"active":true,"expires_at":"2024-12-18","access_level":40,"token":"glpat-yvbXshosBourTuxaddTN"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "232" + - "231" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:42 GMT + - Sun, 13 Oct 2024 12:38:41 GMT Etag: - - W/"55af25ad82d2a3379994fa0e6a91fb14" + - W/"b38b3cf68e8622b73ded4deebf67cca2" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -125,14 +125,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXQXQK75MR6126XEQX4QY","version":"1"}' + - '{"correlation_id":"01JA2Y6N58XJW7X1W0KQKG4X5S","version":"1"}' X-Request-Id: - - 01J9ZRXQXQK75MR6126XEQX4QY + - 01JA2Y6N58XJW7X1W0KQKG4X5S X-Runtime: - - "0.143481" + - "0.218887" status: 201 Created code: 201 - duration: 147.308708ms + duration: 222.127083ms - id: 2 request: proto: HTTP/1.1 @@ -161,22 +161,22 @@ interactions: proto_minor: 1 transfer_encoding: [] trailer: {} - content_length: 199 + content_length: 198 uncompressed: false - body: '{"id":63,"name":"project","revoked":false,"created_at":"2024-10-12T07:08:42.946Z","scopes":["read_api"],"user_id":18,"last_used_at":"2024-10-12T07:08:43.116Z","active":true,"expires_at":"2024-10-18"}' + body: '{"id":50,"name":"project","revoked":false,"created_at":"2024-10-13T12:38:41.278Z","scopes":["read_api"],"user_id":8,"last_used_at":"2024-10-13T12:38:41.542Z","active":true,"expires_at":"2024-12-18"}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - keep-alive Content-Length: - - "199" + - "198" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:43 GMT + - Sun, 13 Oct 2024 12:38:41 GMT Etag: - - W/"426a82112248927e42fb358adcdf69f8" + - W/"bacd3191f3adb053b767c927e436edf1" Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -190,14 +190,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXR70M9DM078MAV32JF4D","version":"1"}' + - '{"correlation_id":"01JA2Y6NK8GF1F1M0GB371MN3H","version":"1"}' X-Request-Id: - - 01J9ZRXR70M9DM078MAV32JF4D + - 01JA2Y6NK8GF1F1M0GB371MN3H X-Runtime: - - "0.022686" + - "0.044892" status: 200 OK code: 200 - duration: 26.388292ms + duration: 52.550666ms - id: 3 request: proto: HTTP/1.1 @@ -218,7 +218,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/63 + url: http://localhost:8080/api/v4/projects/example%2Fexample/access_tokens/50 method: DELETE response: proto: HTTP/1.1 @@ -235,7 +235,7 @@ interactions: Connection: - keep-alive Date: - - Sat, 12 Oct 2024 07:08:43 GMT + - Sun, 13 Oct 2024 12:38:41 GMT Referrer-Policy: - strict-origin-when-cross-origin Server: @@ -249,14 +249,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXR8RQ6PYHKMWCDNKN3Q4","version":"1"}' + - '{"correlation_id":"01JA2Y6NPH7RK5SH8CYCXVJFPA","version":"1"}' X-Request-Id: - - 01J9ZRXR8RQ6PYHKMWCDNKN3Q4 + - 01JA2Y6NPH7RK5SH8CYCXVJFPA X-Runtime: - - "0.035687" + - "0.092725" status: 204 No Content code: 204 - duration: 38.899083ms + duration: 95.765458ms - id: 4 request: proto: HTTP/1.1 @@ -298,7 +298,7 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:08:43 GMT + - Sun, 13 Oct 2024 12:38:41 GMT Server: - nginx Vary: @@ -306,11 +306,11 @@ interactions: Www-Authenticate: - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." X-Gitlab-Meta: - - '{"correlation_id":"01J9ZRXRB7GAZS8YPHSRC86TFD","version":"1"}' + - '{"correlation_id":"01JA2Y6NWJGM2DEYKWDYPVW7X8","version":"1"}' X-Request-Id: - - 01J9ZRXRB7GAZS8YPHSRC86TFD + - 01JA2Y6NWJGM2DEYKWDYPVW7X8 X-Runtime: - - "0.008614" + - "0.008327" status: 401 Unauthorized code: 401 - duration: 11.306667ms + duration: 11.218708ms diff --git a/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml b/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml index 8000584..5e47680 100644 --- a/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml +++ b/testdata/fixtures/16.11.6/TestWithServiceAccountGroup.yaml @@ -29,20 +29,20 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 400 + content_length: 252 uncompressed: false - body: '{"id":75,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:43.045Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features","sudo","admin_mode","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:13:26.222Z","active":true,"expires_at":"2025-10-12"}' + body: '{"id":78,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-13T12:45:46.815Z","scopes":["api","read_api","read_user","sudo","admin_mode"],"user_id":2,"last_used_at":"2024-10-13T12:49:05.355Z","active":true,"expires_at":"2024-11-12"}' headers: Cache-Control: - max-age=0, private, must-revalidate Content-Length: - - "400" + - "252" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:26 GMT + - Sun, 13 Oct 2024 12:49:05 GMT Etag: - - W/"bb9c6ccfbd0282f27010978cf2b43422" + - W/"b3d26443df799a3330591d7c04051b4c" Server: - nginx Vary: @@ -52,14 +52,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6CKHCGGE74FY48141648","version":"1"}' + - '{"correlation_id":"01JA2YSPR443ZE9RNGDW6YSH01","version":"1"}' X-Request-Id: - - 01J9ZS6CKHCGGE74FY48141648 + - 01JA2YSPR443ZE9RNGDW6YSH01 X-Runtime: - - "0.241438" + - "0.086320" status: 200 OK code: 200 - duration: 662.8745ms + duration: 442.064792ms - id: 1 request: proto: HTTP/1.1 @@ -92,7 +92,7 @@ interactions: trailer: {} content_length: 112 uncompressed: false - body: '{"id":130,"username":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015","name":"Service account user"}' + body: '{"id":132,"username":"service_account_group_265_62c6a7f98441380f65190ce34b95c600","name":"Service account user"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -101,9 +101,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:27 GMT + - Sun, 13 Oct 2024 12:49:06 GMT Etag: - - W/"af3bccd2d828d21b8aa01ec07380d5f3" + - W/"918e123d2db0d9ca359f403713662770" Server: - nginx Vary: @@ -113,14 +113,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6DK1QEQF4CSJR8TFFGJS","version":"1"}' + - '{"correlation_id":"01JA2YSQ9HTFW61RZZPTD5DQ8W","version":"1"}' X-Request-Id: - - 01J9ZS6DK1QEQF4CSJR8TFFGJS + - 01JA2YSQ9HTFW61RZZPTD5DQ8W X-Runtime: - - "0.701755" + - "0.706449" status: 201 Created code: 201 - duration: 768.591666ms + duration: 732.564042ms - id: 2 request: proto: HTTP/1.1 @@ -141,7 +141,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users?username=service_account_group_265_920e8e0c29976fb684fd1fa97c480015 + url: https://git.matoski.com/api/v4/users?username=service_account_group_265_62c6a7f98441380f65190ce34b95c600 method: GET response: proto: HTTP/2.0 @@ -151,7 +151,7 @@ interactions: trailer: {} content_length: 1771 uncompressed: false - body: '[{"id":130,"username":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/72c2ffb343ab4d7fccd0d9905716bb6508b66f6f93da507feb3a0ed965474d39?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_group_265_920e8e0c29976fb684fd1fa97c480015","created_at":"2024-10-12T07:13:27.376Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-12T07:13:27.277Z","last_activity_on":null,"email":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_group_265_920e8e0c29976fb684fd1fa97c480015@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":369,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":265,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' + body: '[{"id":132,"username":"service_account_group_265_62c6a7f98441380f65190ce34b95c600","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/d36c56cd3bcea98ef6cd13946f5479399bddff8c102a09865da32ce601baa4f6?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_group_265_62c6a7f98441380f65190ce34b95c600","created_at":"2024-10-13T12:49:06.085Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-13T12:49:05.995Z","last_activity_on":null,"email":"service_account_group_265_62c6a7f98441380f65190ce34b95c600@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_group_265_62c6a7f98441380f65190ce34b95c600@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":371,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":265,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -160,11 +160,11 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:28 GMT + - Sun, 13 Oct 2024 12:49:07 GMT Etag: - - W/"60bc0c23047f390e5f28149527a8c638" + - W/"c3d3a924595c6d1222a518bfd72a9fa9" Link: - - ; rel="first", ; rel="last" + - ; rel="first", ; rel="last" Server: - nginx Vary: @@ -174,7 +174,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6F39MPBJNA6C2Z1K6VGM","version":"1"}' + - '{"correlation_id":"01JA2YSRQFCNJHRSM5P9KX0RHY","version":"1"}' X-Next-Page: - "" X-Page: @@ -184,16 +184,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9ZS6F39MPBJNA6C2Z1K6VGM + - 01JA2YSRQFCNJHRSM5P9KX0RHY X-Runtime: - - "0.207292" + - "0.136749" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 235.430625ms + duration: 163.203041ms - id: 3 request: proto: HTTP/1.1 @@ -205,7 +205,7 @@ interactions: host: git.matoski.com remote_addr: "" request_uri: "" - body: '{"scopes":["read_service_ping","read_user","sudo","admin_mode"],"name":"vault-generated-group-service-account-token","expires_at":"2024-10-14"}' + body: '{"scopes":["read_service_ping","read_user","sudo","admin_mode"],"name":"vault-generated-group-service-account-token","expires_at":"2024-12-14"}' form: {} headers: Accept: @@ -216,7 +216,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/groups/265/service_accounts/130/personal_access_tokens + url: https://git.matoski.com/api/v4/groups/265/service_accounts/132/personal_access_tokens method: POST response: proto: HTTP/2.0 @@ -226,7 +226,7 @@ interactions: trailer: {} content_length: 292 uncompressed: false - body: '{"id":76,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:29.218Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":130,"last_used_at":null,"active":true,"expires_at":"2024-10-14","token":"glpat-L2KsvC_apY6d1sYaPodZ"}' + body: '{"id":79,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-13T12:49:07.716Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":132,"last_used_at":null,"active":true,"expires_at":"2024-12-14","token":"glpat--zyAc2LTaSHDAitzEAqZ"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -235,9 +235,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:29 GMT + - Sun, 13 Oct 2024 12:49:07 GMT Etag: - - W/"2cdcd83ad5d0df6d417c04470696a1e9" + - W/"66ef3f65f8db60d4ac1546f55a7d5ffd" Server: - nginx Vary: @@ -247,14 +247,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6FHW402THTRM08Y8SYDR","version":"1"}' + - '{"correlation_id":"01JA2YSS1MD957XNH8BWAZFNCQ","version":"1"}' X-Request-Id: - - 01J9ZS6FHW402THTRM08Y8SYDR + - 01JA2YSS1MD957XNH8BWAZFNCQ X-Runtime: - - "0.151933" + - "0.195890" status: 201 Created code: 201 - duration: 174.654167ms + duration: 219.028542ms - id: 4 request: proto: HTTP/1.1 @@ -285,7 +285,7 @@ interactions: trailer: {} content_length: 277 uncompressed: false - body: '{"id":76,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:29.218Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":130,"last_used_at":"2024-10-12T07:13:29.529Z","active":true,"expires_at":"2024-10-14"}' + body: '{"id":79,"name":"vault-generated-group-service-account-token","revoked":false,"created_at":"2024-10-13T12:49:07.716Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":132,"last_used_at":"2024-10-13T12:49:08.140Z","active":true,"expires_at":"2024-12-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -294,9 +294,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:29 GMT + - Sun, 13 Oct 2024 12:49:08 GMT Etag: - - W/"91c40a9f8895b5ec0c2bfbaa9077250c" + - W/"27b7ec77f60d15142da895987b209391" Server: - nginx Vary: @@ -306,14 +306,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6FWWQ2CDQBSTS88CAE3H","version":"1"}' + - '{"correlation_id":"01JA2YSSFF8FDVY76CBFEF4T1N","version":"1"}' X-Request-Id: - - 01J9ZS6FWWQ2CDQBSTS88CAE3H + - 01JA2YSSFF8FDVY76CBFEF4T1N X-Runtime: - - "0.075660" + - "0.386524" status: 200 OK code: 200 - duration: 98.709584ms + duration: 416.044334ms - id: 5 request: proto: HTTP/1.1 @@ -349,7 +349,7 @@ interactions: Cache-Control: - no-cache Date: - - Sat, 12 Oct 2024 07:13:29 GMT + - Sun, 13 Oct 2024 12:49:09 GMT Server: - nginx Vary: @@ -359,14 +359,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6G33F3ZR12M956GGEWEK","version":"1"}' + - '{"correlation_id":"01JA2YST9H6YJ7V9F4MP1A8DFB","version":"1"}' X-Request-Id: - - 01J9ZS6G33F3ZR12M956GGEWEK + - 01JA2YST9H6YJ7V9F4MP1A8DFB X-Runtime: - - "0.048523" + - "0.085022" status: 204 No Content code: 204 - duration: 71.483833ms + duration: 110.858709ms - id: 6 request: proto: HTTP/1.1 @@ -387,7 +387,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users/130 + url: https://git.matoski.com/api/v4/users/132 method: DELETE response: proto: HTTP/2.0 @@ -402,7 +402,7 @@ interactions: Cache-Control: - no-cache Date: - - Sat, 12 Oct 2024 07:13:29 GMT + - Sun, 13 Oct 2024 12:49:09 GMT Server: - nginx Vary: @@ -412,11 +412,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6G7KHWDHBGJQYS467D56","version":"1"}' + - '{"correlation_id":"01JA2YSTGD376194FSK6W3XGQ6","version":"1"}' X-Request-Id: - - 01J9ZS6G7KHWDHBGJQYS467D56 + - 01JA2YSTGD376194FSK6W3XGQ6 X-Runtime: - - "0.052501" + - "0.056386" status: 204 No Content code: 204 - duration: 75.169208ms + duration: 78.903333ms diff --git a/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml b/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml index 55d33a2..fbd6e5f 100644 --- a/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml +++ b/testdata/fixtures/16.11.6/TestWithServiceAccountUser.yaml @@ -29,20 +29,20 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 400 + content_length: 252 uncompressed: false - body: '{"id":75,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-12T07:12:43.045Z","scopes":["api","read_api","read_user","create_runner","manage_runner","k8s_proxy","read_repository","write_repository","read_registry","write_registry","ai_features","sudo","admin_mode","read_service_ping"],"user_id":2,"last_used_at":"2024-10-12T07:13:26.222Z","active":true,"expires_at":"2025-10-12"}' + body: '{"id":78,"name":"vault-plugin-test-token","revoked":false,"created_at":"2024-10-13T12:45:46.815Z","scopes":["api","read_api","read_user","sudo","admin_mode"],"user_id":2,"last_used_at":"2024-10-13T12:49:05.355Z","active":true,"expires_at":"2024-11-12"}' headers: Cache-Control: - max-age=0, private, must-revalidate Content-Length: - - "400" + - "252" Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:30 GMT + - Sun, 13 Oct 2024 12:49:10 GMT Etag: - - W/"bb9c6ccfbd0282f27010978cf2b43422" + - W/"b3d26443df799a3330591d7c04051b4c" Server: - nginx Vary: @@ -52,14 +52,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6GCFDYP6ANNKPAYDZPEA","version":"1"}' + - '{"correlation_id":"01JA2YSW3K3TR04YV990C5F5PA","version":"1"}' X-Request-Id: - - 01J9ZS6GCFDYP6ANNKPAYDZPEA + - 01JA2YSW3K3TR04YV990C5F5PA X-Runtime: - - "0.027345" + - "0.028981" status: 200 OK code: 200 - duration: 50.875958ms + duration: 158.647125ms - id: 1 request: proto: HTTP/1.1 @@ -92,7 +92,7 @@ interactions: trailer: {} content_length: 102 uncompressed: false - body: '{"id":131,"username":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b","name":"Service account user"}' + body: '{"id":133,"username":"service_account_4623be513481a023ef6ba6f465745ccb","name":"Service account user"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -101,9 +101,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:30 GMT + - Sun, 13 Oct 2024 12:49:11 GMT Etag: - - W/"124d496fc565987e8f74b59e8a81873e" + - W/"28d749082cac9fdb60adaa1091dec5cc" Server: - nginx Vary: @@ -113,14 +113,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6GFQW191AXNPM9X9V8G5","version":"1"}' + - '{"correlation_id":"01JA2YSWA9E5X76PP7J72MSCN8","version":"1"}' X-Request-Id: - - 01J9ZS6GFQW191AXNPM9X9V8G5 + - 01JA2YSWA9E5X76PP7J72MSCN8 X-Runtime: - - "0.345204" + - "0.312263" status: 201 Created code: 201 - duration: 464.354916ms + duration: 375.661625ms - id: 2 request: proto: HTTP/1.1 @@ -141,7 +141,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users?username=service_account_1dd5652e5a2b4e7efcde27f11fa41e9b + url: https://git.matoski.com/api/v4/users?username=service_account_4623be513481a023ef6ba6f465745ccb method: GET response: proto: HTTP/2.0 @@ -151,7 +151,7 @@ interactions: trailer: {} content_length: 1732 uncompressed: false - body: '[{"id":131,"username":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/d9535977dd36a267d6f0d394b85f4f1a5068b93006fce18d4c73c1adb77bcf5e?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_1dd5652e5a2b4e7efcde27f11fa41e9b","created_at":"2024-10-12T07:13:30.207Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-12T07:13:30.136Z","last_activity_on":null,"email":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_1dd5652e5a2b4e7efcde27f11fa41e9b@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":370,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":null,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' + body: '[{"id":133,"username":"service_account_4623be513481a023ef6ba6f465745ccb","name":"Service account user","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/fe18a522b9c0e2c46e1647af3ca1796ee86ff7cd0329731a255366be973976ca?s=80\u0026d=identicon","web_url":"https://git.matoski.com/service_account_4623be513481a023ef6ba6f465745ccb","created_at":"2024-10-13T12:49:11.106Z","bio":"","location":"","public_email":null,"skype":"","linkedin":"","twitter":"","discord":"","website_url":"","organization":"","job_title":"","pronouns":null,"bot":true,"work_information":null,"followers":0,"following":0,"is_followed":false,"local_time":null,"last_sign_in_at":null,"confirmed_at":"2024-10-13T12:49:11.019Z","last_activity_on":null,"email":"service_account_4623be513481a023ef6ba6f465745ccb@noreply.git.matoski.com","theme_id":3,"color_scheme_id":1,"projects_limit":0,"current_sign_in_at":null,"identities":[],"can_create_group":false,"can_create_project":false,"two_factor_enabled":false,"external":true,"private_profile":false,"commit_email":"service_account_4623be513481a023ef6ba6f465745ccb@noreply.git.matoski.com","shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"scim_identities":[],"is_admin":false,"note":null,"namespace_id":372,"created_by":{"id":2,"username":"ilijamt","name":"Ilija Matoski","state":"active","locked":false,"avatar_url":"https://secure.gravatar.com/avatar/e1bd6bdeae5b3bcd803934a067f39933dd21f9da7974c8e3623ee21ece5fea61?s=80\u0026d=identicon","web_url":"https://git.matoski.com/ilijamt"},"email_reset_offered_at":null,"using_license_seat":false,"is_auditor":false,"provisioned_by_group_id":null,"enterprise_group_id":null,"enterprise_group_associated_at":null}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -160,11 +160,11 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:31 GMT + - Sun, 13 Oct 2024 12:49:11 GMT Etag: - - W/"e88d9c883b387c9d524b2072ee28161e" + - W/"da11102832b8b74ab77f944c168dfe27" Link: - - ; rel="first", ; rel="last" + - ; rel="first", ; rel="last" Server: - nginx Vary: @@ -174,7 +174,7 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6HCYQJPAXDJBVY9NMEKT","version":"1"}' + - '{"correlation_id":"01JA2YSX1YXK2YHK1DGDF9MQAE","version":"1"}' X-Next-Page: - "" X-Page: @@ -184,16 +184,16 @@ interactions: X-Prev-Page: - "" X-Request-Id: - - 01J9ZS6HCYQJPAXDJBVY9NMEKT + - 01JA2YSX1YXK2YHK1DGDF9MQAE X-Runtime: - - "0.133227" + - "0.047887" X-Total: - "1" X-Total-Pages: - "1" status: 200 OK code: 200 - duration: 160.147958ms + duration: 76.08475ms - id: 3 request: proto: HTTP/1.1 @@ -205,7 +205,7 @@ interactions: host: git.matoski.com remote_addr: "" request_uri: "" - body: '{"name":"vault-generated-user-service-account-token","expires_at":"2024-10-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' + body: '{"name":"vault-generated-user-service-account-token","expires_at":"2024-12-14","scopes":["read_service_ping","read_user","sudo","admin_mode"]}' form: {} headers: Accept: @@ -216,7 +216,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users/131/personal_access_tokens + url: https://git.matoski.com/api/v4/users/133/personal_access_tokens method: POST response: proto: HTTP/2.0 @@ -226,7 +226,7 @@ interactions: trailer: {} content_length: 291 uncompressed: false - body: '{"id":77,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:31.388Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":131,"last_used_at":null,"active":true,"expires_at":"2024-10-14","token":"glpat-ZvRxxbVNF6kXV5XfHsnn"}' + body: '{"id":80,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-13T12:49:11.932Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":133,"last_used_at":null,"active":true,"expires_at":"2024-12-14","token":"glpat--eipYeYixg9xn38exZDJ"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -235,9 +235,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:31 GMT + - Sun, 13 Oct 2024 12:49:11 GMT Etag: - - W/"3e8d015c0a830b4955782785c2589519" + - W/"83e45713be8cb4b8597e4e5a8f862f46" Server: - nginx Vary: @@ -247,14 +247,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6HPWWMPKM5VDW3AGGA9T","version":"1"}' + - '{"correlation_id":"01JA2YSX6PESKH4QZ55WFKE0NC","version":"1"}' X-Request-Id: - - 01J9ZS6HPWWMPKM5VDW3AGGA9T + - 01JA2YSX6PESKH4QZ55WFKE0NC X-Runtime: - - "0.059684" + - "0.063184" status: 201 Created code: 201 - duration: 82.40575ms + duration: 88.511417ms - id: 4 request: proto: HTTP/1.1 @@ -285,7 +285,7 @@ interactions: trailer: {} content_length: 276 uncompressed: false - body: '{"id":77,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-12T07:13:31.388Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":131,"last_used_at":"2024-10-12T07:13:31.543Z","active":true,"expires_at":"2024-10-14"}' + body: '{"id":80,"name":"vault-generated-user-service-account-token","revoked":false,"created_at":"2024-10-13T12:49:11.932Z","scopes":["read_service_ping","read_user","sudo","admin_mode"],"user_id":133,"last_used_at":"2024-10-13T12:49:12.086Z","active":true,"expires_at":"2024-12-14"}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -294,9 +294,9 @@ interactions: Content-Type: - application/json Date: - - Sat, 12 Oct 2024 07:13:31 GMT + - Sun, 13 Oct 2024 12:49:12 GMT Etag: - - W/"76191cfbce819104706b54f9f4c117a3" + - W/"1826afe02d216601a5684f39aaa8db19" Server: - nginx Vary: @@ -306,14 +306,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6HW2KM7XMG4EHTKQX988","version":"1"}' + - '{"correlation_id":"01JA2YSXCAXCE7CQA0ATWAWQMM","version":"1"}' X-Request-Id: - - 01J9ZS6HW2KM7XMG4EHTKQX988 + - 01JA2YSXCAXCE7CQA0ATWAWQMM X-Runtime: - - "0.041593" + - "0.031311" status: 200 OK code: 200 - duration: 64.315583ms + duration: 58.185708ms - id: 5 request: proto: HTTP/1.1 @@ -349,7 +349,7 @@ interactions: Cache-Control: - no-cache Date: - - Sat, 12 Oct 2024 07:13:31 GMT + - Sun, 13 Oct 2024 12:49:12 GMT Server: - nginx Vary: @@ -359,14 +359,14 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6J04AHMR1AWDB4SMDMFT","version":"1"}' + - '{"correlation_id":"01JA2YSXFX5PAYHQSSBJ0K29ME","version":"1"}' X-Request-Id: - - 01J9ZS6J04AHMR1AWDB4SMDMFT + - 01JA2YSXFX5PAYHQSSBJ0K29ME X-Runtime: - - "0.144704" + - "0.071212" status: 204 No Content code: 204 - duration: 170.06675ms + duration: 96.199542ms - id: 6 request: proto: HTTP/1.1 @@ -387,7 +387,7 @@ interactions: - REPLACED-TOKEN User-Agent: - go-gitlab - url: https://git.matoski.com/api/v4/users/131 + url: https://git.matoski.com/api/v4/users/133 method: DELETE response: proto: HTTP/2.0 @@ -402,7 +402,7 @@ interactions: Cache-Control: - no-cache Date: - - Sat, 12 Oct 2024 07:13:32 GMT + - Sun, 13 Oct 2024 12:49:12 GMT Server: - nginx Vary: @@ -412,11 +412,11 @@ interactions: X-Frame-Options: - SAMEORIGIN X-Gitlab-Meta: - - '{"correlation_id":"01J9ZS6JATV0HAS7CWYR32NKQP","version":"1"}' + - '{"correlation_id":"01JA2YSXP0QDVVYEJCS0SNN4RA","version":"1"}' X-Request-Id: - - 01J9ZS6JATV0HAS7CWYR32NKQP + - 01JA2YSXP0QDVVYEJCS0SNN4RA X-Runtime: - - "0.032885" + - "0.033928" status: 204 No Content code: 204 - duration: 55.29275ms + duration: 57.962791ms diff --git a/testdata/replays/default.sh b/testdata/replays/default.sh new file mode 100644 index 0000000..2eacb3f --- /dev/null +++ b/testdata/replays/default.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -eux + +vault write gitlab/config/default base_url=http://localhost:9000 token=glpat-secret-random-token auto_rotate_token=false auto_rotate_before=48h type=self-managed +vault write gitlab/roles/normal-user name='{{ .role_name }}-{{ .token_type }}-test' path=normal-user scopes="read_api" token_type=personal ttl=48h +TMPFILE=$(mktemp) +vault read -format=yaml gitlab/token/normal-user | tee "$TMPFILE" +curl --fail -H "Private-Token: $(cat $TMPFILE | yq .data.token)" http://localhost:9000/api/v4/personal_access_tokens/self +vault lease revoke -prefix gitlab/token/normal-user +vault write -f gitlab/config/default/rotate +vault read -format=yaml gitlab/token/normal-user | tee "$TMPFILE" +curl --fail -H "Private-Token: $(cat $TMPFILE | yq .data.token)" http://localhost:9000/api/v4/personal_access_tokens/self +vault lease revoke -prefix gitlab/token/normal-user +curl -H "Private-Token: $(cat $TMPFILE | yq .data.token)" http://localhost:9000/api/v4/personal_access_tokens/self +rm "$TMPFILE" \ No newline at end of file diff --git a/testdata/replays/default.yaml b/testdata/replays/default.yaml new file mode 100644 index 0000000..294b494 --- /dev/null +++ b/testdata/replays/default.yaml @@ -0,0 +1,949 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: false + body: !!binary | + H4sIAAAAAAAAA1VQSW7DMAz8SsGzHVhqXKf6Qe45tSgEwmIKIrYkaHFTFP176STdTiQHQw + 5nPoAdGNWAx5nAwN5zYZzuSjiRhwYSLdIJ5YhTpgbGRFjIWSxC1p3ett3QKnVQO9PfG/2w + GR71k+zlMUTKYJ4BI1/uoCz9tjVTWmnVBSnoZvZ2Do5kuErYVL2/cE67bGMK5/fvM4liyF + xCWpG3xIXsPwjZHuXLmuSBm7KoLTySjexf4aWBVd7enE+YixXgrynVtUoftDgazLbbqF6t + pnAsvEhKJVWJgs6RReIniv4aBXx+AR+IBedUAQAA + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:18 GMT + Etag: + - W/"b38f519a482eaeb484ea0f6985d4fa3a" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZDZBHJ4JXCKCYERX25Y7","version":"1"}' + X-Request-Id: + - 01JA1GZDZBHJ4JXCKCYERX25Y7 + X-Runtime: + - "0.106242" + status: 200 OK + code: 200 + duration: 0s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/users?username=normal-user + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: false + body: !!binary | + H4sIAAAAAAAAA31Ty47bMAz8lcLnPCQ7dhwDi/YLemov3S4EWaaz3MiSIcnrpkX/vZStdN + OiaE4WyZDDmeHjjwy7rCk22eTBGTlA1mTGukHqbYxkmywFPy7Bd5/XoA8yxFKpAr4CVWmr + LkCdeqk9bDL5KoN0YnKaip5DGH2z38/zvDu7NbVTdtivn/uCARSyhu7EVZ6zrq3qWhZtB5 + yXKmfFsSraQ17z4nhQB1YXZV+deFUf60qWJyb79/6hZl8nxvKqe8AOTEBlDYGaob2DQAh4 + m5fQl/zYnur9n2sqB7RSJ2QgxDnLD1t23HL+iddNWTSs2h3q8gv1bNFSwbqxDEhzltc4tR + qVgEEirWwmrTeZv1zHSFIsRkP0YCoOM4ZA5C6pDr2yjqiLD0LsMUBCTQHrztLg97tJL7YV + AYNOnUdnjZ2Mvw1tLS2QVJituwg0fZRuhboC663WdgZHf2KbbH2hOS8v9CKl39QkcaWmod + EdawctfRAez4baL5StYaK9Rzf8l0aeRxqXBot7MFzFwuJCOmdEOuUTkcmLHxYEFA7PMIBI + llVWWye8+h3jpIOzL6CCFxoHJFycxd8mU5NzZIx/YF4NExCIjccnqpRGrGYQZ2enMWuCm8 + jSd/E05JYJsxU97UJgwMhW390BfCOdDUG/STI6pNMAQS16jBomqegcCO/NP3+vTaLIboj2 + SeXGxvNbSY8H6kep3nhJVm6vt5KFTeHAQxC278ElhWKDn0+/ANH795AFBAAA + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:19 GMT + Etag: + - W/"25fe2b64ac6604f6b3a8740f4910a720" + Link: + - ; rel="first", ; rel="last" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZEBGSWZ66XFBY2AR2TSV","version":"1"}' + X-Next-Page: + - "" + X-Page: + - "1" + X-Per-Page: + - "20" + X-Prev-Page: + - "" + X-Request-Id: + - 01JA1GZEBGSWZ66XFBY2AR2TSV + X-Runtime: + - "0.297640" + X-Total: + - "1" + X-Total-Pages: + - "1" + status: 200 OK + code: 200 + duration: 0s + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 84 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: '{"name":"normal-user-personal-test","expires_at":"2024-10-15","scopes":["read_api"]}' + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Content-Length: + - "84" + Content-Type: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/users/3/personal_access_tokens + method: POST + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 231 + uncompressed: false + body: '{"id":43,"name":"normal-user-personal-test","revoked":false,"created_at":"2024-10-12T23:28:19.450Z","scopes":["read_api"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-10-15","token":"glpat-gyUVKnnP67j1LxTG6h1y"}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Length: + - "231" + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:19 GMT + Etag: + - W/"44400d155946bad60433fee2b172d729" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZEYRTD02Q8CZEGKFNAX6","version":"1"}' + X-Request-Id: + - 01JA1GZEYRTD02Q8CZEGKFNAX6 + X-Runtime: + - "0.087702" + status: 201 Created + code: 201 + duration: 0s + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - '*/*' + Private-Token: + - REPLACED-TOKEN + User-Agent: + - curl/8.7.1 + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 216 + uncompressed: false + body: '{"id":43,"name":"normal-user-personal-test","revoked":false,"created_at":"2024-10-12T23:28:19.450Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-12T23:28:19.710Z","active":true,"expires_at":"2024-10-15"}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Length: + - "216" + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:19 GMT + Etag: + - W/"7752d2338e5f888cccc41598a33bb8a6" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZF56PTSE57J0MY7DW8XQ","version":"1"}' + X-Request-Id: + - 01JA1GZF56PTSE57J0MY7DW8XQ + X-Runtime: + - "0.184465" + status: 200 OK + code: 200 + duration: 0s + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/43 + method: DELETE + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Date: + - Sat, 12 Oct 2024 23:28:20 GMT + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZFKQMWXPGZBD4245DWBS","version":"1"}' + X-Request-Id: + - 01JA1GZFKQMWXPGZBD4245DWBS + X-Runtime: + - "0.029929" + status: 204 No Content + code: 204 + duration: 0s + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: false + body: !!binary | + H4sIAAAAAAAAA1VQSW7DMAz8SsGzHVhqXKf6Qe45tSgEwmIKIrYkaHFTFP176STdTiQHQw + 5nPoAdGNWAx5nAwN5zYZzuSjiRhwYSLdIJ5YhTpgbGRFjIWSxC1p3ett3QKnVQO9PfG/2w + GR71k+zlMUTKYJ4BI1/uoCz9tjVTWmnVBSnoZvZ2Do5kuErYVL2/cE67bGMK5/fvM4liyF + xCWpG3xIXsPwjZHuXLmuSBm7KoLTySjexf4aWBVd7enE+YixXgrynVtUoftDgazLbbqF6t + pnAsvEhKJVWJgs6RReIniv4aBXx+AR+IBedUAQAA + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:20 GMT + Etag: + - W/"b38f519a482eaeb484ea0f6985d4fa3a" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZFNJ446RQ0F3BNBE2105","version":"1"}' + X-Request-Id: + - 01JA1GZFNJ446RQ0F3BNBE2105 + X-Runtime: + - "0.015941" + status: 200 OK + code: 200 + duration: 0s + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/users/1 + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: false + body: !!binary | + H4sIAAAAAAAAA31T226cMBD9F54TFnuBZZGitv+Qp15k+TLsTgI2sk1IWvXfO+ZS7cMqPM + HMYS7nnPmTocla9pBNAbyVA2Rt5p2L2UO2fX0zA1oM0cvoPIVDlDGhpI74BhTonX4FKtLJ + PsBDJt9klF5MvifQNcYxtIfDPM/5xa+pXLvhsL4eeNWYxugzq41qNEiuZadqfdSm0KrgZQ + 0dFDUrOTPKNEfQR3msipI3Wiojy+5LeGqKn1NR8No8oQEbUTtLQ82gbkagCZjiFXQVO6lz + c9g21B5oFyNkpFE5tXssTo+MPbOmrVhbFvmZV9+pmEJHgHVVGZEaLF/jpHrUAgaJtKud+p + 7Yef0YEzsJjJZ4wQ0cZ4wR/JoyGLTzxFnC0agBI2zjUsD5i7T4+6bTi1MiYuy3yqN31k02 + 7E0V6bXTPzv/KtB2zg9bgXUwUkn2VCQpvEVkiCLgxRL8LgVly3nenMtEAbHaoR8+I6s5so + TsU9nFHBg/xMLVQi0rHhmn/EZXJpOvvsK7HMYekicoF68wgEiOPKaWvfMi6P8xcilt/gI6 + BtHjgLQ0K9JD2Ml7Ev/OOqktey5Obdm0RZ2fmmXI1SoRgTj88Yv+l1asbhAX76Yxa6OfyM + w38a31nomzEx2tSSOClaq/uQB4J6GtJE9sJzF6pKMAQSU6TCJucVqattgNdJcRDGIham9r + XTq+VcB0oGGUemWM2Nn9rD52yEK28BAgCtd14DcB1wJXvFyB1PIuDXWHRiQiMnbmOaubvK + 5ytuu72+YeYM9psihJxP/+A43sCW5kBAAA + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:20 GMT + Etag: + - W/"85f16854e4bc1761a35643ec1a0f721d" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZFPSP0K54545C7HPX903","version":"1"}' + X-Request-Id: + - 01JA1GZFPSP0K54545C7HPX903 + X-Runtime: + - "0.021831" + status: 200 OK + code: 200 + duration: 0s + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 27 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: '{"expires_at":"2025-10-12"}' + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Content-Length: + - "27" + Content-Type: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/1/rotate + method: POST + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: false + body: !!binary | + H4sIAAAAAAAAA1VQ20rEMBD9FZnnVrppl655X1QUn2QfFAmxnS7DpknIpVbEf3e69YJPmR + zOnMt8APUgm6YAq0cECbeWEmlzkdwJLRQQcOKJOYM2EQvoAuqEvdKJyaISTbmpyo14FLUU + OymqS3HVPvFe7JzHCPIZtKezjualvzFHDAst944f3Y9k1eh65M9qoUK29sw57aLywc3vPz + IBvYuUXFiQt0AJ1T9Ikxo4ZQ4c4NuZ3SbqUHmyR3gpYLFXS/VNAUbHpBhYS9lsDAfqEk18 + jxQyl8bZE4v9lt6upVl8PZOEo/E6lfXhLrY317PFdqgP9/ty+/AKn1+BdoOQZAEAAA== + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:20 GMT + Etag: + - W/"546585af58b550da258d22d2ebff5dcc" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZFRB4C85PFES2BE0MQ0B","version":"1"}' + X-Request-Id: + - 01JA1GZFRB4C85PFES2BE0MQ0B + X-Runtime: + - "0.071128" + status: 200 OK + code: 200 + duration: 0s + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/users?username=normal-user + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: false + body: !!binary | + H4sIAAAAAAAAA31Ty47bMAz8lcLnPCQ7dhwDi/YLemov3S4EWaaz3MiSIcnrpkX/vZStdN + OiaE4WyZDDmeHjjwy7rCk22eTBGTlA1mTGukHqbYxkmywFPy7Bd5/XoA8yxFKpAr4CVWmr + LkCdeqk9bDL5KoN0YnKaip5DGH2z38/zvDu7NbVTdtivn/uCARSyhu7EVZ6zrq3qWhZtB5 + yXKmfFsSraQ17z4nhQB1YXZV+deFUf60qWJyb79/6hZl8nxvKqe8AOTEBlDYGaob2DQAh4 + m5fQl/zYnur9n2sqB7RSJ2QgxDnLD1t23HL+iddNWTSs2h3q8gv1bNFSwbqxDEhzltc4tR + qVgEEirWwmrTeZv1zHSFIsRkP0YCoOM4ZA5C6pDr2yjqiLD0LsMUBCTQHrztLg97tJL7YV + AYNOnUdnjZ2Mvw1tLS2QVJituwg0fZRuhboC663WdgZHf2KbbH2hOS8v9CKl39QkcaWmod + EdawctfRAez4baL5StYaK9Rzf8l0aeRxqXBot7MFzFwuJCOmdbnlM+EZm8+GFBQOHwDAOI + ZFlltXXCq98xTjo4+wIqeKFxQMLFWfxtMjU5R8b4B+bVMAGB2Hh8okppxGoGcXZ2GrMmuI + ksfRdPQ26ZMFvR0y4EBoxs9d0dwDfS2RD0mySjQzoNENSix6hhkorOgfDe/PP32iSK7IZo + n1RubDy/lfR4oH6U6o2XZOX2eitZ2BQOPARh+x5cUig2+Pn0C7eIBBMFBAAA + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:20 GMT + Etag: + - W/"7be42b6c66a2642d326e3f34619d0f11" + Link: + - ; rel="first", ; rel="last" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Accept-Encoding + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZFZK9DN6PVD416HKFST4","version":"1"}' + X-Next-Page: + - "" + X-Page: + - "1" + X-Per-Page: + - "20" + X-Prev-Page: + - "" + X-Request-Id: + - 01JA1GZFZK9DN6PVD416HKFST4 + X-Runtime: + - "0.253158" + X-Total: + - "1" + X-Total-Pages: + - "1" + status: 200 OK + code: 200 + duration: 0s + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 84 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: '{"name":"normal-user-personal-test","expires_at":"2024-10-15","scopes":["read_api"]}' + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Content-Length: + - "84" + Content-Type: + - application/json + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/users/3/personal_access_tokens + method: POST + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 231 + uncompressed: false + body: '{"id":45,"name":"normal-user-personal-test","revoked":false,"created_at":"2024-10-12T23:28:21.018Z","scopes":["read_api"],"user_id":3,"last_used_at":null,"active":true,"expires_at":"2024-10-15","token":"glpat-Cq42QMcKLFq4AysHeF-Z"}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Length: + - "231" + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:21 GMT + Etag: + - W/"91d340775cfe50c02138dabe0576b5bf" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZGFSAPACKFVPBKJY2X4S","version":"1"}' + X-Request-Id: + - 01JA1GZGFSAPACKFVPBKJY2X4S + X-Runtime: + - "0.038496" + status: 201 Created + code: 201 + duration: 0s + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - '*/*' + Private-Token: + - REPLACED-TOKEN + User-Agent: + - curl/8.7.1 + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 216 + uncompressed: false + body: '{"id":45,"name":"normal-user-personal-test","revoked":false,"created_at":"2024-10-12T23:28:21.018Z","scopes":["read_api"],"user_id":3,"last_used_at":"2024-10-12T23:28:21.113Z","active":true,"expires_at":"2024-10-15"}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - keep-alive + Content-Length: + - "216" + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:21 GMT + Etag: + - W/"f51324911f8ac297e7d7be1d26be5596" + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZGKGRVAYNDSXHY42XBPE","version":"1"}' + X-Request-Id: + - 01JA1GZGKGRVAYNDSXHY42XBPE + X-Runtime: + - "0.013968" + status: 200 OK + code: 200 + duration: 0s + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - '*/*' + Private-Token: + - REPLACED-TOKEN + User-Agent: + - curl/8.7.1 + url: http://localhost:8080/api/v4/personal_access_tokens/self + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 106 + uncompressed: false + body: '{"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Length: + - "106" + Content-Type: + - application/json + Date: + - Sat, 12 Oct 2024 23:28:21 GMT + Server: + - nginx + Vary: + - Origin + Www-Authenticate: + - Bearer realm="Protected by OAuth 2.0", error="invalid_token", error_description="Token was revoked. You have to re-authorize from the user." + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZGQJ2R12BC8MPH3QD39H","version":"1"}' + X-Request-Id: + - 01JA1GZGQJ2R12BC8MPH3QD39H + X-Runtime: + - "0.013628" + status: 401 Unauthorized + code: 401 + duration: 0s + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: localhost:8080 + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + Accept-Encoding: + - gzip + Private-Token: + - REPLACED-TOKEN + User-Agent: + - go-gitlab + url: http://localhost:8080/api/v4/personal_access_tokens/45 + method: DELETE + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Date: + - Sat, 12 Oct 2024 23:28:21 GMT + Referrer-Policy: + - strict-origin-when-cross-origin + Server: + - nginx + Strict-Transport-Security: + - max-age=63072000 + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - SAMEORIGIN + X-Gitlab-Meta: + - '{"correlation_id":"01JA1GZGPZC746MVDY5FRQ5N04","version":"1"}' + X-Request-Id: + - 01JA1GZGPZC746MVDY5FRQ5N04 + X-Runtime: + - "0.077411" + status: 204 No Content + code: 204 + duration: 0s diff --git a/with_admin_user_pat_gitlab_revokes_token_test.go b/with_admin_user_pat_gitlab_revokes_token_test.go index d643607..d82a060 100644 --- a/with_admin_user_pat_gitlab_revokes_token_test.go +++ b/with_admin_user_pat_gitlab_revokes_token_test.go @@ -68,7 +68,8 @@ func TestWithAdminUser_PAT_AdminUser_GitlabRevokesToken(t *testing.T) { // issue a personal access token { - resp, err := b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err := b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/normal-user", gitlab.PathTokenRoleStorage), }) diff --git a/with_admin_user_pat_vault_revokes_token_test.go b/with_admin_user_pat_vault_revokes_token_test.go index 6d68e78..efcf68d 100644 --- a/with_admin_user_pat_vault_revokes_token_test.go +++ b/with_admin_user_pat_vault_revokes_token_test.go @@ -69,7 +69,8 @@ func TestWithAdminUser_PAT_AdminUser_VaultRevokesToken(t *testing.T) { // issue a personal access token { - resp, err := b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err := b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/admin-user", gitlab.PathTokenRoleStorage), }) diff --git a/with_gitlab_com_user_rotate_token_test.go b/with_gitlab_com_user_rotate_token_test.go index 9ef2d9d..bb1dcd8 100644 --- a/with_gitlab_com_user_rotate_token_test.go +++ b/with_gitlab_com_user_rotate_token_test.go @@ -42,7 +42,8 @@ func TestWithGitlabUser_RotateToken(t *testing.T) { // Rotate the main token { - resp, err := b.HandleRequest(ctx, &logical.Request{ + ctxRotate, _ := ctxTestTime(ctx, t.Name()) + resp, err := b.HandleRequest(ctxRotate, &logical.Request{ Operation: logical.UpdateOperation, Path: fmt.Sprintf("%s/%s/rotate", gitlab.PathConfigStorage, gitlab.DefaultConfigName), Storage: l, Data: map[string]any{}, diff --git a/with_normal_user_gat_test.go b/with_normal_user_gat_test.go index 16c5a03..66beb3f 100644 --- a/with_normal_user_gat_test.go +++ b/with_normal_user_gat_test.go @@ -64,7 +64,8 @@ func TestWithNormalUser_GAT(t *testing.T) { // issue a group access token { - resp, err := b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err := b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/gat", gitlab.PathTokenRoleStorage), }) diff --git a/with_normal_user_personal_at_fails_test.go b/with_normal_user_personal_at_fails_test.go index 4e64f1b..5a2f2f7 100644 --- a/with_normal_user_personal_at_fails_test.go +++ b/with_normal_user_personal_at_fails_test.go @@ -62,7 +62,8 @@ func TestWithNormalUser_PersonalAT_Fails(t *testing.T) { // issue a personal access token { - resp, err := b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err := b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/normal-user", gitlab.PathTokenRoleStorage), }) diff --git a/with_normal_user_project_at_test.go b/with_normal_user_project_at_test.go index a447417..723772d 100644 --- a/with_normal_user_project_at_test.go +++ b/with_normal_user_project_at_test.go @@ -69,7 +69,8 @@ func TestWithNormalUser_ProjectAT(t *testing.T) { // issue a group access token { - resp, err := b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err := b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/pat", gitlab.PathTokenRoleStorage), }) diff --git a/with_service_account_fail_test.go b/with_service_account_fail_test.go index 8341794..9b93cab 100644 --- a/with_service_account_fail_test.go +++ b/with_service_account_fail_test.go @@ -41,7 +41,7 @@ func TestWithServiceAccountUserFail(t *testing.T) { require.NotEmpty(t, events) require.NotNil(t, b.GetClient(gitlab.DefaultConfigName)) - var gClient = b.GetClient(gitlab.DefaultConfigName).GitlabClient() + var gClient = b.GetClient(gitlab.DefaultConfigName).GitlabClient(ctx) require.NotNil(t, gClient) usr, _, err := gClient.Users.CreateServiceAccountUser() diff --git a/with_service_account_group_test.go b/with_service_account_group_test.go index 5699367..3043926 100644 --- a/with_service_account_group_test.go +++ b/with_service_account_group_test.go @@ -39,7 +39,7 @@ func TestWithServiceAccountGroup(t *testing.T) { require.NotEmpty(t, events) require.NotNil(t, b.GetClient(gitlab.DefaultConfigName)) - var gClient = b.GetClient(gitlab.DefaultConfigName).GitlabClient() + var gClient = b.GetClient(gitlab.DefaultConfigName).GitlabClient(ctx) require.NotNil(t, gClient) // Create a group service account @@ -72,7 +72,8 @@ func TestWithServiceAccountGroup(t *testing.T) { require.EqualValues(t, resp.Data["config_name"], gitlab.TypeConfigDefault) // Get a new token for the service account - resp, err = b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err = b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/group-service-account", gitlab.PathTokenRoleStorage), }) diff --git a/with_service_account_user_test.go b/with_service_account_user_test.go index a84335b..b797840 100644 --- a/with_service_account_user_test.go +++ b/with_service_account_user_test.go @@ -38,7 +38,7 @@ func TestWithServiceAccountUser(t *testing.T) { require.NotEmpty(t, events) require.NotNil(t, b.GetClient(gitlab.DefaultConfigName)) - var gClient = b.GetClient(gitlab.DefaultConfigName).GitlabClient() + var gClient = b.GetClient(gitlab.DefaultConfigName).GitlabClient(ctx) require.NotNil(t, gClient) // Create a service account user @@ -70,7 +70,8 @@ func TestWithServiceAccountUser(t *testing.T) { require.EqualValues(t, resp.Data["config_name"], gitlab.TypeConfigDefault) // Get a new token for the service account - resp, err = b.HandleRequest(ctx, &logical.Request{ + ctxIssueToken, _ := ctxTestTime(ctx, t.Name()) + resp, err = b.HandleRequest(ctxIssueToken, &logical.Request{ Operation: logical.ReadOperation, Storage: l, Path: fmt.Sprintf("%s/user-service-account", gitlab.PathTokenRoleStorage), })