You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/11/11 16:05:16 UTC
[13/17] incubator-slider git commit: SLIDER-622 spin for deletion
SLIDER-622 spin for deletion
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/75963870
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/75963870
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/75963870
Branch: refs/heads/releases/slider-0.60
Commit: 7596387040446aa8bac157f09fc028fe4b699981
Parents: 632346e
Author: Steve Loughran <st...@apache.org>
Authored: Tue Nov 11 13:50:59 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Nov 11 15:04:47 2014 +0000
----------------------------------------------------------------------
.../slider/test/YarnMiniClusterTestBase.groovy | 32 +++++++++++++++++---
1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/75963870/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
index dde8239..0850d25 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
@@ -18,7 +18,6 @@
package org.apache.slider.test
-import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
@@ -493,10 +492,7 @@ public abstract class YarnMiniClusterTestBase extends ServiceLauncherBaseTest {
log.info("deleting customer data at $clusterDir")
//this is a safety check to stop us doing something stupid like deleting /
assert clusterDir.toString().contains("/.slider/")
- dfs.delete(clusterDir, true)
- sleep(1000)
- dfs.delete(clusterDir, true)
- assert !dfs.exists(clusterDir), "delete operation failed —application in use?"
+ rigorousDelete(dfs, clusterDir, 60000)
}
@@ -544,6 +540,32 @@ public abstract class YarnMiniClusterTestBase extends ServiceLauncherBaseTest {
}
/**
+ * Delete with some pauses and backoff; designed to handle slow delete
+ * operation in windows
+ * @param dfs
+ * @param clusterDir
+ */
+ public void rigorousDelete(
+ HadoopFS dfs, Path clusterDir, long timeout) {
+ Duration duration = new Duration(timeout)
+ duration.start()
+ boolean deleted = false;
+ while (!deleted) {
+ dfs.delete(clusterDir, true)
+ deleted = !dfs.exists(clusterDir)
+ if (!deleted ) {
+ if (duration.limitExceeded) {
+ assert !dfs.exists(
+ clusterDir), "delete operation failed —directory in use?"
+
+ }
+ sleep(1000)
+ }
+
+ }
+ }
+
+ /**
* Add arguments to launch Slider with.
*
* Extra arguments are added after standard arguments and before roles.