(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func 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 | |
| 131 | func TestAgentGitSSHKey_APIKeyScopes(t *testing.T) { |
| 132 | t.Parallel() |
nothing calls this directly
no test coverage detected