Fix rebase issues
This commit is contained in:
1 parent
c74579cead
commit
97f800d396
5 files changed
+20
-6
No files matched your search
@@ -33,14 +33,14 @@ func defaultSessionFunc(ctx context.Context, addr, authTok string, refreshTok Re
|
||||
return nil, nil, "", errors.Wrap(ctx, err, op)
|
||||
}
|
||||
sClient := sessions.NewClient(client)
|
||||
l, err := sClient.List(ctx, "global", sessions.WithIncludeTerminated(true), sessions.WithRecursive(true), sessions.WithRefreshToken(string(refreshTok)))
|
||||
l, err := sClient.List(ctx, "global", sessions.WithIncludeTerminated(true), sessions.WithRecursive(true), sessions.WithListToken(string(refreshTok)))
|
||||
if err != nil {
|
||||
if api.ErrInvalidRefreshToken.Is(err) {
|
||||
return nil, nil, "", err
|
||||
}
|
||||
return nil, nil, "", errors.Wrap(ctx, err, op)
|
||||
}
|
||||
return l.Items, l.RemovedIds, RefreshTokenValue(l.RefreshToken), nil
|
||||
return l.Items, l.RemovedIds, RefreshTokenValue(l.ListToken), nil
|
||||
}
|
||||
|
||||
// refreshSessions uses attempts to refresh the sessions for the provided user
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/hashicorp/boundary/api/authtokens"
|
||||
"github.com/hashicorp/boundary/api/sessions"
|
||||
"github.com/hashicorp/boundary/api/targets"
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
cachedb "github.com/hashicorp/boundary/internal/clientcache/internal/db"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller"
|
||||
"github.com/hashicorp/boundary/internal/daemon/worker"
|
||||
@@ -446,6 +447,12 @@ func TestRepository_QuerySessions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDefaultSessionRetrievalFunc(t *testing.T) {
|
||||
oldDur := globals.RefreshReadLookbackDuration
|
||||
globals.RefreshReadLookbackDuration = 0
|
||||
t.Cleanup(func() {
|
||||
globals.RefreshReadLookbackDuration = oldDur
|
||||
})
|
||||
|
||||
tc := controller.NewTestController(t, nil)
|
||||
tc.Client().SetToken(tc.Token().Token)
|
||||
tarClient := targets.NewClient(tc.Client())
|
||||
|
||||
@@ -33,14 +33,14 @@ func defaultTargetFunc(ctx context.Context, addr, authTok string, refreshTok Ref
|
||||
return nil, nil, "", errors.Wrap(ctx, err, op)
|
||||
}
|
||||
tarClient := targets.NewClient(client)
|
||||
l, err := tarClient.List(ctx, "global", targets.WithRecursive(true), targets.WithRefreshToken(string(refreshTok)))
|
||||
l, err := tarClient.List(ctx, "global", targets.WithRecursive(true), targets.WithListToken(string(refreshTok)))
|
||||
if err != nil {
|
||||
if api.ErrInvalidRefreshToken.Is(err) {
|
||||
return nil, nil, "", err
|
||||
}
|
||||
return nil, nil, "", errors.Wrap(ctx, err, op)
|
||||
}
|
||||
return l.Items, l.RemovedIds, RefreshTokenValue(l.RefreshToken), nil
|
||||
return l.Items, l.RemovedIds, RefreshTokenValue(l.ListToken), nil
|
||||
}
|
||||
|
||||
// refreshTargets uses attempts to refresh the targets for the provided user
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/hashicorp/boundary/api/authtokens"
|
||||
"github.com/hashicorp/boundary/api/targets"
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
cachedb "github.com/hashicorp/boundary/internal/clientcache/internal/db"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller"
|
||||
"github.com/hashicorp/boundary/internal/db"
|
||||
@@ -422,6 +423,12 @@ func TestRepository_QueryTargets(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDefaultTargetRetrievalFunc(t *testing.T) {
|
||||
oldDur := globals.RefreshReadLookbackDuration
|
||||
globals.RefreshReadLookbackDuration = 0
|
||||
t.Cleanup(func() {
|
||||
globals.RefreshReadLookbackDuration = oldDur
|
||||
})
|
||||
|
||||
tc := controller.NewTestController(t, nil)
|
||||
tc.Client().SetToken(tc.Token().Token)
|
||||
tarClient := targets.NewClient(tc.Client())
|
||||
@@ -443,7 +450,7 @@ func TestDefaultTargetRetrievalFunc(t *testing.T) {
|
||||
got2, removed2, refTok2, err := defaultTargetFunc(tc.Context(), tc.ApiAddrs()[0], tc.Token().Token, refTok)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, refTok2)
|
||||
assert.NotEqual(t, refTok2, refTok)
|
||||
assert.Empty(t, removed2)
|
||||
// Note: This will sometimes fail until PR 3897 is merged
|
||||
assert.Empty(t, got2)
|
||||
}
|
||||
@@ -147,7 +147,7 @@ type Command struct {
|
||||
|
||||
// New returns a new instance of a base.Command type
|
||||
func NewCommand(ui cli.Ui, opt ...Option) *Command {
|
||||
opts := getOpts(opt...)
|
||||
opts := GetOpts(opt...)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ret := &Command{
|
||||
UI: ui,
|
||||
|
||||
Reference in new issue
Block a user