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 Reload_Detector through the language server #11792

Open
GregoryTravis opened this issue Dec 5, 2024 · 6 comments
Open

Test Reload_Detector through the language server #11792

GregoryTravis opened this issue Dec 5, 2024 · 6 comments
Assignees
Labels
-libs Libraries: New libraries to be implemented p-low Low priority

Comments

@GregoryTravis
Copy link
Contributor

Write a test that checks that the Managed_Resource cache-clearing method in Reload_Detector works correctly, without using a fake trigger, as the test in Fetch_Spec.enso does. Original discussion

Options are:

  • Add a builtin that allows scheduleFinalizationOfSystemReferences to be called from Enso
  • Write a test like RuntimeExecutionEnvironmentTest.scala
  • Write a test like ManagedResourceTest.java
@GregoryTravis GregoryTravis added p-low Low priority -libs Libraries: New libraries to be implemented labels Dec 5, 2024
@GregoryTravis GregoryTravis self-assigned this Dec 5, 2024
@github-project-automation github-project-automation bot moved this to ❓New in Issues Board Dec 5, 2024
@JaroslavTulach
Copy link
Member

Add a builtin that allows scheduleFinalizationOfSystemReferences to be called from Enso

No, I am against adding builtins just to artificially increase test coverage.

@JaroslavTulach
Copy link
Member

JaroslavTulach commented Dec 6, 2024

Just to repeat myself: Logic of Managed_Resource.register ref on_finalize Boolean.True is unit tested at

ensoCtx.getResourceManager().scheduleFinalizationOfSystemReferences();

We have a unit test of Managed_Resource and another unit test for ReloadDetector, then I believe we have 100% coverage and there is no need to seek more coverage. At least I would personally wait for first bug report about something being broken. Just my 2 Kč.

had the tests pass but the feature fail to work

If one has too... then it is up to you guys... just no builtins or anything that would be visible (and I don't count ## PRIVATE comments as hiding anything) for Enso users.

@radeusgd
Copy link
Member

radeusgd commented Dec 6, 2024

had the tests pass but the feature fail to work

Yes we already had a bug in there. There's no report because we managed to find it before the PR introducing it was even merged. But that suggests that the test coverage is not enough for this feature - as @GregoryTravis noted - all unit tests were passing but the feature was not working.

If one has too... then it is up to you guys... just no builtins or anything that would be visible (and I don't count ## PRIVATE comments as hiding anything) for Enso users.

@JaroslavTulach What about a private builtin? Only testable in Base_Internal_Tests which has the private access enabled? It would be far easier than instrumenting a language server scenario.

@GregoryTravis
Copy link
Contributor Author

@JaroslavTulach I respect your opinion about not adding builtins -- so the alternative for this is a Scala test, I think. Can you point to a test that I could base this on? One that can trigger the real resource finalization, and examine the effect on a real Enso value.

@JaroslavTulach
Copy link
Member

I believe you can make a copy of ManagedResourceTest:

I believe it tests everything:

  • scheduleFinalizationOfSystemReferences
  • assertGC
  • Managed_Resource

It should be a great base for your test.

@radeusgd
Copy link
Member

btw. reading the #11673 PR I think it would also be good to add a test that ensures that clicking the refresh button once, ensures that reload happens only once. To avoid a situation where clicking refresh button would cause caches to be effectively disabled.

Thus the test should not be testing Reload_Detector (which is missing the 'reset' logic) but the ReloadDetector.java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-libs Libraries: New libraries to be implemented p-low Low priority
Projects
Status: New
Development

No branches or pull requests

3 participants