| 56 | } |
| 57 | |
| 58 | func TestWorkspaceAgentLogText(t *testing.T) { |
| 59 | t.Parallel() |
| 60 | |
| 61 | ts := time.Date(2024, 1, 28, 10, 30, 0, 0, time.UTC) |
| 62 | log := codersdk.WorkspaceAgentLog{ |
| 63 | CreatedAt: ts, |
| 64 | Level: codersdk.LogLevelInfo, |
| 65 | Output: "Agent started successfully", |
| 66 | SourceID: uuid.New(), |
| 67 | } |
| 68 | result := log.Text("main", "startup_script") |
| 69 | require.Equal(t, "2024-01-28T10:30:00Z [info] [agent.main|startup_script] Agent started successfully", result) |
| 70 | } |
| 71 | |
| 72 | func TestWorkspaceAgentLogTextEmptySourceAndAgent(t *testing.T) { |
| 73 | t.Parallel() |