From 8345928d742e2f4a624234755ddd256f5e0df0a0 Mon Sep 17 00:00:00 2001 From: Ilija Matoski Date: Wed, 21 Feb 2024 19:55:21 +0100 Subject: [PATCH] fix: deprecated functions from gitlab package g.Time to g.Ptr --- helpers_test.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/helpers_test.go b/helpers_test.go index b69894c..92a35e5 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -4,17 +4,19 @@ import ( "context" "errors" "fmt" + "slices" + "sync" + "testing" + "time" + log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-multierror" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/logical" - gitlab "github.com/ilijamt/vault-plugin-secrets-gitlab" "github.com/stretchr/testify/require" g "github.com/xanzy/go-gitlab" - "slices" - "sync" - "testing" - "time" + + gitlab "github.com/ilijamt/vault-plugin-secrets-gitlab" ) func countErrByName(err *multierror.Error) map[string]int { @@ -107,8 +109,8 @@ func newInMemoryClient(valid bool) *inMemoryClient { valid: valid, accessTokens: make(map[string]gitlab.EntryToken), - mainTokenInfo: gitlab.EntryToken{CreatedAt: g.Time(time.Now()), ExpiresAt: g.Time(time.Now())}, - rotateMainToken: gitlab.EntryToken{CreatedAt: g.Time(time.Now()), ExpiresAt: g.Time(time.Now())}, + mainTokenInfo: gitlab.EntryToken{CreatedAt: g.Ptr(time.Now()), ExpiresAt: g.Ptr(time.Now())}, + rotateMainToken: gitlab.EntryToken{CreatedAt: g.Ptr(time.Now()), ExpiresAt: g.Ptr(time.Now())}, } } @@ -172,7 +174,7 @@ func (i *inMemoryClient) CreatePersonalAccessToken(username string, userId int, Name: name, Token: "", TokenType: gitlab.TokenTypePersonal, - CreatedAt: g.Time(time.Now()), + CreatedAt: g.Ptr(time.Now()), ExpiresAt: &expiresAt, Scopes: scopes, } @@ -196,7 +198,7 @@ func (i *inMemoryClient) CreateGroupAccessToken(groupId string, name string, exp Name: name, Token: "", TokenType: gitlab.TokenTypeGroup, - CreatedAt: g.Time(time.Now()), + CreatedAt: g.Ptr(time.Now()), ExpiresAt: &expiresAt, Scopes: scopes, AccessLevel: accessLevel, @@ -221,7 +223,7 @@ func (i *inMemoryClient) CreateProjectAccessToken(projectId string, name string, Name: name, Token: "", TokenType: gitlab.TokenTypeProject, - CreatedAt: g.Time(time.Now()), + CreatedAt: g.Ptr(time.Now()), ExpiresAt: &expiresAt, Scopes: scopes, AccessLevel: accessLevel,