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

x/tools/gopls/internal/regtest/diagnostics: failing test hangs instead of reporting failure #54825

Closed
griesemer opened this issue Sep 2, 2022 · 3 comments
Assignees
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@griesemer
Copy link
Contributor

From the test log associated with CL 426477:

#### End Gopls Test Logs for "TestEditGoDirectiveWorkspace/default"
--- FAIL: TestEditGoDirectiveWorkspace (27.63s)
    --- FAIL: TestEditGoDirectiveWorkspace/default (27.63s)
        diagnostics_test.go:2144: waiting on:
            Unmet: once "main.go: diagnostic at {line:2, column:7} (location of \"T any\") with message \"type parameters require\"" is met, must have:
            read diagnostics for "main.go"
            
            err:context deadline exceeded
            
            state:
            #### log messages (see RPC logs for full text):
            	Info: "2022/09/01 22:23:27 go env for /workdir/tmp/gopls-...
            	Info: "2022/09/01 22:23:27 go/packages.Load #202\n\tsnaps...
            	Info: "2022/09/01 22:23:27 go/packages.Load #202: updatin...
            
            #### diagnostics:
            	main.go (version 0):
            		(2, 7): type parameter requires go1.18 or later
            		(2, 9): predeclared any requires go1.18 or later
            
            #### outstanding work:
            #### completed work:
            	Load: 1
            	Setting up workspace: 1
            	diagnosing initial workspace load: 1
            
FAIL
FAIL	golang.org/x/tools/gopls/internal/regtest/diagnostics	599.048s

The test is supposed to fail with an error message (fix is CL 427736), but instead it times out. Running locally, the test appears to never finish.

@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 2, 2022
@griesemer griesemer added this to the Go1.20 milestone Sep 2, 2022
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Sep 2, 2022
@griesemer
Copy link
Contributor Author

To reproduce, simply change the expected error in gopls/internal/regtest/diagnostics/diagnostics_test.go:2112 to an incorrect message.

@findleyr findleyr modified the milestones: Go1.20, gopls/v0.10.0 Sep 2, 2022
@gopherbot
Copy link

Change https://go.dev/cl/427543 mentions this issue: gopls/internal/regtest: TestEditGoDirectiveWorkspace should fail eagerly

@findleyr
Copy link
Contributor

findleyr commented Sep 2, 2022

Much of the LSP is communicated via bidirection notifications, and doesn't lend itself to operate-and-assert style testing, so our test framework must support the notion of something happening "eventually". Initially, this was the best we could do, but we've added additional instrumentation that allows us to express things like "once gopls is done processing this change, we should have a diagnostic in the editor", and most if not all tests can be written to fail eagerly. This is done in CL 427543.

@golang golang locked and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants