public static FilePath GetTestDir(Type caller, bool create) { FilePath dir = new FilePath(Runtime.GetProperty("test.build.data", "target/test/data" ) + "/" + RandomStringUtils.RandomAlphanumeric(10), caller.Name); if (create) { dir.Mkdirs(); } return(dir); }
public FSTestWrapper(string testRootDir) { // // Test helper methods taken from FileContextTestHelper // // Use default test dir if not provided if (testRootDir == null || testRootDir.IsEmpty()) { testRootDir = Runtime.GetProperty("test.build.data", "build/test/data"); } // salt test dir with some random digits for safe parallel runs this.testRootDir = testRootDir + "/" + RandomStringUtils.RandomAlphanumeric(10); }
/// <summary> /// Function to test whether a dir is working correctly by actually creating a /// random directory. /// </summary> /// <param name="dir">the dir to test</param> /// <exception cref="System.IO.IOException"/> private void VerifyDirUsingMkdir(FilePath dir) { string randomDirName = RandomStringUtils.RandomAlphanumeric(5); FilePath target = new FilePath(dir, randomDirName); int i = 0; while (target.Exists()) { randomDirName = RandomStringUtils.RandomAlphanumeric(5) + i; target = new FilePath(dir, randomDirName); i++; } try { DiskChecker.CheckDir(target); } finally { FileUtils.DeleteQuietly(target); } }
/// <summary>Create helper with test root located at <wd>/build/test/data</summary> public FileSystemTestHelper() : this(Runtime.GetProperty("test.build.data", "target/test/data") + "/" + RandomStringUtils .RandomAlphanumeric(10)) { }