diff options
author | Michael Keppler | 2019-10-13 06:02:33 +0000 |
---|---|---|
committer | Thomas Wolf | 2019-11-27 09:22:23 +0000 |
commit | c609d6d4e309baf590feeed2d30db4e21eb05e40 (patch) | |
tree | 813116a0f844d066a7a8e93ac1ba99930bcc98fb /org.eclipse.egit.ui.test | |
parent | beeaff3c6ab98bc1685d5657b4ae3dec26c7f6c2 (diff) | |
download | egit-c609d6d4e309baf590feeed2d30db4e21eb05e40.tar.gz egit-c609d6d4e309baf590feeed2d30db4e21eb05e40.tar.xz egit-c609d6d4e309baf590feeed2d30db4e21eb05e40.zip |
[releng] Try project deletion multiple times
We sometimes see test failures in the master build caused by not being
able to delete a test project. See builds 173, 170, 165... for examples.
Therefore repeat project deletion in case of error, as it may be locked
by some other concurrent processing.
Change-Id: I3dbeba99a4d5bf5a6e0c9e960c5abb2277c057a1
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r-- | org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/JavaProjectTester.java | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/JavaProjectTester.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/JavaProjectTester.java index eb602c628a..4013f75da3 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/JavaProjectTester.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/JavaProjectTester.java @@ -32,6 +32,7 @@ import org.eclipse.egit.core.Activator; import org.eclipse.egit.core.internal.indexdiff.IndexDiffCache; import org.eclipse.egit.core.op.CommitOperation; import org.eclipse.egit.core.op.ConnectProviderOperation; +import org.eclipse.egit.core.test.TestUtils; import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; @@ -61,10 +62,6 @@ public class JavaProjectTester { public static final String INITIAL_FILE_CONTENT = "package " + PACKAGE_NAME + ";\nclass " + JAVA_CLASS_NAME + " {\n\n}"; - private static final int MAX_DELETE_RETRY = 5; - - private static final int DELETE_RETRY_DELAY = 1000; // ms - private final LocalRepositoryTestCase testCase; public JavaProjectTester(LocalRepositoryTestCase testCase) { @@ -190,40 +187,7 @@ public class JavaProjectTester { return; } final IProject project = javaProject.getProject(); - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - @Override - public void run(IProgressMonitor monitor) throws CoreException { - // Following code inspired by {@link - // org.eclipse.jdt.testplugin.JavaProjectHelper#delete(IResource)}. - // I don't like all this sleeping at all, but apparently it's - // needed because the Java indexer might still run and hold on - // to some resources. - for (int i = 0; i < MAX_DELETE_RETRY; i++) { - try { - project.delete(IResource.FORCE - | IResource.ALWAYS_DELETE_PROJECT_CONTENT, - null); - break; - } catch (CoreException e) { - if (i == MAX_DELETE_RETRY - 1) { - throw e; - } - try { - Activator.logInfo( - "Sleep before retrying to delete project " - + project.getLocationURI()); - // Give other threads the time to close and release - // the resource. - Thread.sleep(DELETE_RETRY_DELAY); - } catch (InterruptedException e1) { - // Ignore and retry to delete - } - } - } - - } - }; - ResourcesPlugin.getWorkspace().run(runnable, null); + TestUtils.deleteProject(project); } } |