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

Function TestAgentGitSSHKey

coderd/gitsshkey_test.go:103–129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestAgentGitSSHKey(t *testing.T) {
104 t.Parallel()
105
106 client := coderdtest.New(t, &coderdtest.Options{
107 IncludeProvisionerDaemon: true,
108 })
109 user := coderdtest.CreateFirstUser(t, client)
110 authToken := uuid.NewString()
111 version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
112 Parse: echo.ParseComplete,
113 ProvisionPlan: echo.PlanComplete,
114 ProvisionGraph: echo.ProvisionGraphWithAgent(authToken),
115 })
116 project := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
117 coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
118 workspace := coderdtest.CreateWorkspace(t, client, project.ID)
119 coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)
120
121 agentClient := agentsdk.New(client.URL, agentsdk.WithFixedToken(authToken))
122
123 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
124 defer cancel()
125
126 agentKey, err := agentClient.GitSSHKey(ctx)
127 require.NoError(t, err)
128 require.NotEmpty(t, agentKey.PrivateKey)
129}
130
131func TestAgentGitSSHKey_APIKeyScopes(t *testing.T) {
132 t.Parallel()

Callers

nothing calls this directly

Calls 12

NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateTemplateVersionFunction · 0.92
ProvisionGraphWithAgentFunction · 0.92
CreateTemplateFunction · 0.92
CreateWorkspaceFunction · 0.92
NewFunction · 0.92
WithFixedTokenFunction · 0.92
NotEmptyMethod · 0.80
GitSSHKeyMethod · 0.45

Tested by

no test coverage detected