Skip to content

Commit

Permalink
fix: deprecated functions from gitlab package g.Time to g.Ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
ilijamt committed Feb 21, 2024
1 parent 23566cb commit 8345928
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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())},
}
}

Expand Down Expand Up @@ -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,
}
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 8345928

Please sign in to comment.