Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6238a99

Browse files
authored
feat(cli)!: enable keyring usage by default (#20851)
Make keyring usage for session token storage on by default for supportedplatforms (Windows and macOS), with the ability to opt-out via--use-keyring=false.This change will be a breaking change for any users depending on thesession token being stored on disk, though users can restore file usagevia the flag above.This change will also require CLI users to authenticate after updating.
1 parentc266bb8 commit6238a99

File tree

10 files changed

+249
-158
lines changed

10 files changed

+249
-158
lines changed

‎cli/clitest/clitest.go‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import (
2828
)
2929

3030
// New creates a CLI instance with a configuration pointed to a
31-
// temporary testing directory.
31+
// temporary testing directory. The invocation is set up to use a
32+
// global config directory for the given testing.TB, and keyring
33+
// usage disabled.
3234
funcNew(t testing.TB,args...string) (*serpent.Invocation, config.Root) {
3335
varroot cli.RootCmd
3436

@@ -59,23 +61,37 @@ func NewWithCommand(
5961
t testing.TB,cmd*serpent.Command,args...string,
6062
) (*serpent.Invocation, config.Root) {
6163
configDir:=config.Root(t.TempDir())
64+
// Keyring usage is disabled here because many existing tests expect the session token
65+
// to be stored on disk and is not properly instrumented for parallel testing against
66+
// the actual operating system keyring.
67+
invArgs:=append([]string{"--global-config",string(configDir),"--use-keyring=false"},args...)
68+
returnsetupInvocation(t,cmd,invArgs...),configDir
69+
}
70+
71+
funcsetupInvocation(t testing.TB,cmd*serpent.Command,args...string,
72+
)*serpent.Invocation {
6273
// I really would like to fail test on error logs, but realistically, turning on by default
6374
// in all our CLI tests is going to create a lot of flaky noise.
6475
logger:=slogtest.Make(t,&slogtest.Options{IgnoreErrors:true}).
6576
Leveled(slog.LevelDebug).
6677
Named("cli")
6778
i:=&serpent.Invocation{
6879
Command:cmd,
69-
Args:append([]string{"--global-config",string(configDir)},args...),
80+
Args:args,
7081
Stdin:io.LimitReader(nil,0),
7182
Stdout: (&logWriter{prefix:"stdout",log:logger}),
7283
Stderr: (&logWriter{prefix:"stderr",log:logger}),
7384
Logger:logger,
7485
}
7586
t.Logf("invoking command: %s %s",cmd.Name(),strings.Join(i.Args," "))
87+
returni
88+
}
7689

77-
// These can be overridden by the test.
78-
returni,configDir
90+
funcNewWithDefaultKeyringCommand(t testing.TB,cmd*serpent.Command,args...string,
91+
) (*serpent.Invocation, config.Root) {
92+
configDir:=config.Root(t.TempDir())
93+
invArgs:=append([]string{"--global-config",string(configDir)},args...)
94+
returnsetupInvocation(t,cmd,invArgs...),configDir
7995
}
8096

8197
// SetupConfig applies the URL and SessionToken of the client to the config.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp