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/749484c2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/749484c2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/749484c2 Branch: refs/heads/feature/SLIDER-622-windows Commit: 749484c2df3e170f30bba71afa9c5a242238af3b Parents: 2bb2323 Author: Steve Loughran <[email protected]> Authored: Tue Nov 11 13:50:59 2014 +0000 Committer: Steve Loughran <[email protected]> Committed: Tue Nov 11 13:50:59 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/749484c2/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 dcc55f6..2805304 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 @@ -515,10 +514,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) } @@ -566,6 +562,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.
