-
Notifications
You must be signed in to change notification settings - Fork 321
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 for flaky editor sync test #2385 #3211
fix for flaky editor sync test #2385 #3211
Conversation
@LorenzoBettini I've added a sleep of 250ms .. There was an unused and deprecated method, but for my case its not a build process, so i really needed sleeping thread. I am not sure if this helps.. |
IMHO, adding sleeping in tests is very bad design ;) I don't understand the deprecated method you mention. Maybe the problem is that you change the file with Java API and you don't refresh the corresponding eclipse resource? |
Thats the sense of that syncronize :) It must recognize that the file was changed and change the content of the editor. |
Is it ok, to add polling and sleep (5-10ms) to minimize the sleeping? For example wait in total 200ms but poll all 5ms and check if the assert is true.. if after 200ms the value isn't true, fail the test? pollingAssertThat()? |
sleeping is not real synchronization ;) If I understand the test and the implemented functionality correctly, it should be enough to trigger a refresh on the corresponding Eclipse resource, before doing the assert. |
59b76f8
to
34e6fac
Compare
@mehmet-karaman I'm closing the PR and reopen it so that it builds against the new main branch where there's a fix for tests of web projects. |
@mehmet-karaman If I understand correctly:
If I got it correctly, then |
b9ea257
to
34e6fac
Compare
The synchronize is only false for the first time, as it also triggers the synchronize. If it happens outside of my test somehow, it can cause flakyness (as it is only false for the first time executing this method) .. So there is no doubt that we can remove it, the critical part for this test is just the editors document content. The "Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); " could be necessary because it the refresh job should be done before checking the document content. |
Ah maybe you meant "syncUtil.waitForReconciler(editor);" .. I've also removed that.. same reason as waitForBuild.. |
43f8674
to
e71313c
Compare
To me the PR looks good. @szarnekow wdyt? |
e71313c
to
e91e2be
Compare
Its still flaky.. I guess on macosx its a little bit slower with the refresh, so I am going to add another wait for refresh job.. I hope that fixes the test problem for macosx. |
@mehmet-karaman flaky on your machine or here on the CI? If it's on the CI, are you sure the flaky test is the one mentioned here? |
The last macos build failed on the same test: https://github.com/eclipse/xtext/actions/runs/11215846276 |
Isn't refresh synchronous? I mean, when it returns the resource should be already refreshed, shouldn't it? |
I am out of home for this week and i don't have access to my private mac machine. On Linux it works locally and on remote build fine. But on mac remote build it had a problem, which seems to work with the latest change. The next possible time to test this for me on mac is on Saturday evening. |
e91e2be
to
08293be
Compare
Could test it on mac. The refresh is synchronous (states also in the comments that it is long running). Removed the unnecessary refresh job wait after the refreshLocal-method call.. |
Thanks @mehmet-karaman |
added a sleep before assert.. Tested on redhat 9 .. works as before.. tested on mac sonoma 14.6.1 .. works as before.. Needs observation