Skip to content

fix: call agent directly in cli tests #9789

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 2 commits into from
Sep 21, 2023

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Sep 20, 2023

Tests like TestDERPHeaders create an agent, and then run a CLI command that communicates with it.

Prior to this change, we used the CLI itself to start the agent. This

a) is needlessly complicated as it interjects the cli-invocation and pseudoterminal packages
b) makes it impossible to tell which logs came from the agent and which from the CLI command under test, since they both get generically logged by the ptytest package. c.f. https://github.com/coder/coder/actions/runs/6221630697/job/16883998408?pr=9717

So instead, we just start the agent directly with a named logger.

I also start the CLI command under test in TestDERPHeaders with -v so that we get debug logs from it.

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Nice find!

@spikecurtis spikecurtis merged commit 866ba8e into main Sep 21, 2023
@spikecurtis spikecurtis deleted the spike/run-agent-normally-in-cli-tests branch September 21, 2023 09:30
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2023
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