Skip to content

test flake: cliui/TestAgent missing lines #10408

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

Closed
johnstcn opened this issue Oct 27, 2023 · 1 comment · Fixed by #10415
Closed

test flake: cliui/TestAgent missing lines #10408

johnstcn opened this issue Oct 27, 2023 · 1 comment · Fixed by #10415
Assignees

Comments

@johnstcn
Copy link
Member

Seen here: https://github.com/coder/coder/actions/runs/6662837992/job/18107813676?pr=10350

Logs:

=== Failed
=== FAIL: cli/cliui TestAgent/Error_during_fetch (0.02s)
    clitest.go:246: command "" exited with error: running command "": fetch:
            github.com/coder/coder/v2/cli/cliui.Agent
                /home/runner/actions-runner/_work/coder/coder/cli/cliui/agent.go:81
          - fetch workspace agent:
            github.com/coder/coder/v2/cli/cliui.Agent.func2
                /home/runner/actions-runner/_work/coder/coder/cli/cliui/agent.go:59
          - bad:
            github.com/coder/coder/v2/cli/cliui_test.TestAgent.func17
                /home/runner/actions-runner/_work/coder/coder/cli/cliui/agent_test.go:281
    agent_test.go:383: 
        	Error Trace:	/home/runner/actions-runner/_work/coder/coder/cli/cliui/agent_test.go:383
        	Error:      	missing lines: ⧗ Waiting for the workspace agent to connect
        	Test:       	TestAgent/Error_during_fetch

=== FAIL: cli/cliui TestAgent/Disconnected (0.02s)
    clitest.go:246: command "" exited with error: <nil>
    agent_test.go:383: 
        	Error Trace:	/home/runner/actions-runner/_work/coder/coder/cli/cliui/agent_test.go:383
        	Error:      	missing lines: ⧗ The workspace agent lost connection, Wait for it to reconnect or restart your workspace., For more information and troubleshooting, see, ✔ The workspace agent lost connection
        	Test:       	TestAgent/Disconnected

@johnstcn johnstcn added the flake label Oct 27, 2023
@cdr-bot cdr-bot bot added the chore label Oct 27, 2023
@johnstcn johnstcn changed the title test flake: test flake: cliui/TestAgent missing lines Oct 27, 2023
@spikecurtis
Copy link
Contributor

For the Error_during_fetch case, the race is that the agent retries fetching on a separate goroutine, on a timer, so there isn't a controlled number of fetch attempts before the primary agent go routine gets the result.

The test is designed to give different fetch results by reading them off a list, so if there are multiple fetch attempts, it screws up the test.

In order to avoid the race, I think the test has to be redesigned to wait for the logs it's looking for before triggering the different stages of the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants