Skip to content

feat(codersdk/agentsdk): add StartupLogsSender and StartupLogsWriter #8129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Prev Previous commit
Next Next commit
add test for cr
  • Loading branch information
mafredri committed Jun 21, 2023
commit d078203f3592d7e5ee23ce391d393c681793183f
20 changes: 20 additions & 0 deletions codersdk/agentsdk/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,26 @@ func TestStartupLogsWriter_Write(t *testing.T) {
},
},
},
{
name: "removes carraige return when grouped with newline",
ctx: context.Background(),
level: codersdk.LogLevelInfo,
writes: []string{"hello world\r\n", "\r\r\n", "goodbye world\n"},
want: []agentsdk.StartupLog{
{
Level: codersdk.LogLevelInfo,
Output: "hello world",
},
{
Level: codersdk.LogLevelInfo,
Output: "\r",
},
{
Level: codersdk.LogLevelInfo,
Output: "goodbye world",
},
},
},
{
name: "cancel context",
ctx: canceledCtx,
Expand Down