| 84 | } |
| 85 | |
| 86 | func TestWorkspaceAgentLogTextMultiline(t *testing.T) { |
| 87 | t.Parallel() |
| 88 | |
| 89 | ts := time.Date(2024, 1, 28, 10, 30, 0, 0, time.UTC) |
| 90 | log := codersdk.WorkspaceAgentLog{ |
| 91 | CreatedAt: ts, |
| 92 | Level: codersdk.LogLevelInfo, |
| 93 | Output: "Line 1\nLine 2\nLine 3", |
| 94 | SourceID: uuid.New(), |
| 95 | } |
| 96 | result := log.Text("main", "startup_script") |
| 97 | require.Equal(t, "2024-01-28T10:30:00Z [info] [agent.main|startup_script] Line 1\nLine 2\nLine 3", result) |
| 98 | } |
| 99 | |
| 100 | func TestWorkspaceAgentLogTextSpecialChars(t *testing.T) { |
| 101 | t.Parallel() |