(t *testing.T, flags ...string)
| 410 | } |
| 411 | |
| 412 | func 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. |
no test coverage detected