Skip to content
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

test(cli): improve TestServer/SpammyLogs line count #16814

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Mar 5, 2025

This test was failing for me in dogfood (23 > 20).

I noticed that 1) the message for install.sh had changed and 2) we were counting lines incorrectly because of how the pty can move the cursor.

I also added the tf newer than expected to the ignore list, since it isn't something we should normally print, and if we do it's legit.

This is what the test log output now looks like:

=== NAME  TestServer/SpammyLogs
    server_test.go:288: Counting: "Started HTTP listener at http://[::]:37815\r"
    server_test.go:284: Ignoring: "WARN: The access URL  http://localhost:3000/  isn't externally reachable, this may cause unexpected problems when creating workspaces. Generate a unique *.try.coder.app URL by not specifying an access URL.\r"
    server_test.go:288: Counting: "\r\r"
    server_test.go:288: Counting: "╔════════════════════════════╗\r"
    server_test.go:288: Counting: "║      View the Web UI:      ║\r"
    server_test.go:288: Counting: "║   \x1b[4mhttp://localhost:3000/\x1b[0m   ║\r"
    server_test.go:288: Counting: "╚════════════════════════════╝\r\r"
    server_test.go:288: Counting: "\r"
    server_test.go:288: Counting: "==> Logs will stream in below (press ctrl+c to gracefully exit):\r\r"
    server_test.go:284: Ignoring: "2025-03-05 14:13:39.608 [warn]  cli: telemetry disabled, unable to notify of security issues. Read more: https://coder.com/docs/admin/setup/telemetry\r"
    server_test.go:284: Ignoring: "2025-03-05 14:13:39.634 [warn]  cli.coderd.site: could not parse install.sh, it will be unavailable  error=\"open install.sh: file does not exist\"\r"
    server_test.go:284: Ignoring: "2025-03-05 14:13:39.689 [warn]  cli.provisionerd-w-1: installed terraform version newer than expected, you may experience bugs  installed_version=1.11.0  max_version=1.10.9\r"
    server_test.go:284: Ignoring: "2025-03-05 14:13:39.689 [warn]  cli.provisionerd-w-0: installed terraform version newer than expected, you may experience bugs  installed_version=1.11.0  max_version=1.10.9\r"
    server_test.go:284: Ignoring: "2025-03-05 14:13:39.691 [warn]  cli.provisionerd-w-2: installed terraform version newer than expected, you may experience bugs  installed_version=1.11.0  max_version=1.10.9\r"
    server_test.go:288: Counting: ""
    server_test.go:301: numLines: 11

@mafredri mafredri marked this pull request as ready for review March 5, 2025 14:19
Copy link
Contributor

@hugodutka hugodutka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mafredri mafredri merged commit cc946f1 into main Mar 5, 2025
35 checks passed
@mafredri mafredri deleted the mafredri/test-cli-improve-spammy-logs branch March 5, 2025 15:04
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants