Skip to content

Commit

Permalink
Fix Random Failing UIEditWorkingSetWizardAuto.testEditPage eclipse-pl…
Browse files Browse the repository at this point in the history
…atform#275

In my experiments, the test failed in roughly 2% of runs.

The test didn't close all processes and editors before deleting the
files it contained.
This PR Makes the Job-Manager join all jobs before finally deleting the
project-root.

eclipse-platform#275
  • Loading branch information
Wittmaxi committed Apr 9, 2024
1 parent d1fbc3c commit 4759747
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardDialog;
Expand Down Expand Up @@ -135,10 +137,18 @@ private void removeAllWorkingSets() {

private void cleanupWorkspace() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
ResourcesPlugin.getWorkspace().getRoot().delete(true, null);
} catch (CoreException e) {
TestPlugin.getDefault().getLog().log(e.getStatus());
throw createAssertionError(e);
} catch (OperationCanceledException e) {
e.printStackTrace();
throw new AssertionError(e.getMessage(), e);
} catch (InterruptedException e) {
e.printStackTrace();
throw new AssertionError(e.getMessage(), e);
} finally {
project1 = null;
project2 = null;
Expand Down

0 comments on commit 4759747

Please sign in to comment.