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

Function TestCreateAgentClient_GoogleAgentNameEnv

cli/root_test.go:380–397  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

378}
379
380func TestCreateAgentClient_GoogleAgentNameEnv(t *testing.T) {
381 t.Parallel()
382
383 r := &cli.RootCmd{}
384 var client *agentsdk.Client
385 subCmd := agentClientCommand(&client)
386 cmd, err := r.Command([]*serpent.Command{subCmd})
387 require.NoError(t, err)
388 inv, _ := clitest.NewWithCommand(t, cmd,
389 "agent-client",
390 "--auth", "google-instance-identity",
391 "--agent-url", "http://coder.fake")
392 inv.Environ.Set("CODER_AGENT_NAME", "env-agent")
393 err = inv.Run()
394 require.NoError(t, err)
395 require.NotNil(t, client)
396 requireInstanceIdentityAgentName(t, client, &agentsdk.GoogleSessionTokenExchanger{}, "env-agent")
397}
398
399func requireInstanceIdentityAgentName(t *testing.T, client *agentsdk.Client, expectedExchanger any, want string) {
400 t.Helper()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected