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

Fix test BSP service by not using stale state #1839

Merged

Conversation

oyvindberg
Copy link
Contributor

Hey again, this is a followup to #1769 . There, I was stuck for a long while on the new tests for the test BSP service.

It failed like this:

[warn] Skipping test for a because compiler result is empty

@tgodzik made the tests green, and merged it. thanks again.

So then, imagine my surprise when I saw the same error with bloop 1.5.4 when trying to run tests through BSP.

So I dug a bit further and discovered that when running tests bloop will (naturally) first compile, and then run tests. The problem is that the State produced by the compilation is not propagated to the test code, and the previous state is used instead. So if the code hadn't been compiled before for instance, test will see no class files.

For this PR I did a slight revert to the test code in the first commit (keeping the seemingly necessary changes)
The fix is in the second commit, where it propagates the correct state.

…c to work.

The key was to resolve jars correctly, and to specify `enableTests = true`.

Note that this commit leaves the test suite not working, in the same way it was before.

```
[warn] Skipping test for a because compiler result is empty
```
@oyvindberg
Copy link
Contributor Author

I should maybe note that if you want to test this, that bloop CLI is not affected, only BSP.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Good catch!

@tgodzik tgodzik merged commit 4800bca into scalacenter:main Oct 20, 2022
@oyvindberg oyvindberg deleted the bsp-test-endpoint-uses-compile-state branch October 20, 2022 19:05
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 this pull request may close these issues.

2 participants