MCPcopy Index your code
hub / github.com/coder/coder / setupInvocation

Function setupInvocation

cli/clitest/clitest.go:84–101  ·  view source on GitHub ↗
(t testing.TB, cmd *serpent.Command, args ...string,
)

Source from the content-addressed store, hash-verified

82}
83
84func setupInvocation(t testing.TB, cmd *serpent.Command, args ...string,
85) *serpent.Invocation {
86 // I really would like to fail test on error logs, but realistically, turning on by default
87 // in all our CLI tests is going to create a lot of flaky noise.
88 logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).
89 Leveled(slog.LevelDebug).
90 Named("cli")
91 i := &serpent.Invocation{
92 Command: cmd,
93 Args: args,
94 Stdin: io.LimitReader(nil, 0),
95 Stdout: (&logWriter{prefix: "stdout", log: logger}),
96 Stderr: (&logWriter{prefix: "stderr", log: logger}),
97 Logger: logger,
98 }
99 t.Logf("invoking command: %s %s", cmd.Name(), strings.Join(i.Args, " "))
100 return i
101}
102
103func NewWithDefaultKeyringCommand(t testing.TB, cmd *serpent.Command, args ...string,
104) (*serpent.Invocation, config.Root) {

Callers 2

NewWithCommandFunction · 0.85

Calls 3

NamedMethod · 0.80
LogfMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected