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

Function TestExecutorTaskWorkspace

coderd/autobuild/lifecycle_executor_test.go:1860–2087  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1858}
1859
1860func TestExecutorTaskWorkspace(t *testing.T) {
1861 t.Parallel()
1862
1863 createTaskTemplate := func(t *testing.T, client *codersdk.Client, orgID uuid.UUID, ctx context.Context, defaultTTL time.Duration) codersdk.Template {
1864 t.Helper()
1865
1866 taskAppID := uuid.New()
1867 version := coderdtest.CreateTemplateVersion(t, client, orgID, &echo.Responses{
1868 Parse: echo.ParseComplete,
1869 ProvisionGraph: []*proto.Response{
1870 {
1871 Type: &proto.Response_Graph{
1872 Graph: &proto.GraphComplete{
1873 Resources: []*proto.Resource{
1874 {
1875 Agents: []*proto.Agent{
1876 {
1877 Id: uuid.NewString(),
1878 Name: "dev",
1879 Auth: &proto.Agent_Token{
1880 Token: uuid.NewString(),
1881 },
1882 Apps: []*proto.App{
1883 {
1884 Id: taskAppID.String(),
1885 Slug: "task-app",
1886 },
1887 },
1888 },
1889 },
1890 },
1891 },
1892 HasAiTasks: true,
1893 AiTasks: []*proto.AITask{
1894 {
1895 AppId: taskAppID.String(),
1896 },
1897 },
1898 },
1899 },
1900 },
1901 },
1902 })
1903 coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
1904 template := coderdtest.CreateTemplate(t, client, orgID, version.ID)
1905
1906 if defaultTTL > 0 {
1907 _, err := client.UpdateTemplateMeta(ctx, template.ID, codersdk.UpdateTemplateMeta{
1908 DefaultTTLMillis: ptr.Ref(defaultTTL.Milliseconds()),
1909 })
1910 require.NoError(t, err)
1911 }
1912
1913 return template
1914 }
1915
1916 createTaskWorkspace := func(t *testing.T, client *codersdk.Client, template codersdk.Template, ctx context.Context, input string) codersdk.Workspace {
1917 t.Helper()

Callers

nothing calls this directly

Calls 15

CreateTemplateVersionFunction · 0.92
CreateTemplateFunction · 0.92
RefFunction · 0.92
ContextFunction · 0.92
NewWithDatabaseFunction · 0.92
CreateFirstUserFunction · 0.92
MustTransitionWorkspaceFunction · 0.92
GetProvisionerForTagsFunction · 0.92
MustWorkspaceFunction · 0.92

Tested by

no test coverage detected