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

Function createAgentWithFlags

cli/root_test.go:412–425  ·  view source on GitHub ↗
(t *testing.T, flags ...string)

Source from the content-addressed store, hash-verified

410}
411
412func createAgentWithFlags(t *testing.T, flags ...string) *agentsdk.Client {
413 t.Helper()
414 r := &cli.RootCmd{}
415 var client *agentsdk.Client
416 subCmd := agentClientCommand(&client)
417 cmd, err := r.Command([]*serpent.Command{subCmd})
418 require.NoError(t, err)
419 inv, _ := clitest.NewWithCommand(t, cmd,
420 append([]string{"agent-client"}, flags...)...)
421 err = inv.Run()
422 require.NoError(t, err)
423 require.NotNil(t, client)
424 return client
425}
426
427// agentClientCommand creates a subcommand that creates an agent client and stores it in the provided clientRef. Used to
428// test the properties of the client with various root command flags.

Calls 5

CommandMethod · 0.95
NewWithCommandFunction · 0.92
agentClientCommandFunction · 0.85
HelperMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected