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

Function TestTemplateVersionLogs

coderd/templateversions_test.go:1106–1154  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1104}
1105
1106func TestTemplateVersionLogs(t *testing.T) {
1107 t.Parallel()
1108 client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
1109 user := coderdtest.CreateFirstUser(t, client)
1110 version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
1111 Parse: echo.ParseComplete,
1112 ProvisionPlan: echo.PlanComplete,
1113 ProvisionGraph: []*proto.Response{{
1114 Type: &proto.Response_Log{
1115 Log: &proto.Log{
1116 Level: proto.LogLevel_INFO,
1117 Output: "example",
1118 },
1119 },
1120 }, {
1121 Type: &proto.Response_Graph{
1122 Graph: &proto.GraphComplete{
1123 Resources: []*proto.Resource{{
1124 Name: "some",
1125 Type: "example",
1126 Agents: []*proto.Agent{{
1127 Id: "something",
1128 Name: "dev",
1129 Auth: &proto.Agent_Token{
1130 Token: uuid.NewString(),
1131 },
1132 }},
1133 }, {
1134 Name: "another",
1135 Type: "example",
1136 }},
1137 },
1138 },
1139 }},
1140 })
1141
1142 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
1143 defer cancel()
1144
1145 logs, closer, err := client.TemplateVersionLogsAfter(ctx, version.ID, 0)
1146 require.NoError(t, err)
1147 defer closer.Close()
1148 for {
1149 _, ok := <-logs
1150 if !ok {
1151 return
1152 }
1153 }
1154}
1155
1156func TestTemplateVersionLogsFormat(t *testing.T) {
1157 t.Parallel()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateTemplateVersionFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected