Add random hash to the tempDir project dir.
This will allow to create several similar projects from one resource project in a single test. ^KT-45745 In Progress
This commit is contained in:
+7
-1
@@ -165,6 +165,11 @@ private fun TestProject.withBuildSummary(
|
|||||||
*/
|
*/
|
||||||
private val testKitDir get() = Paths.get(".").resolve(".testKitDir")
|
private val testKitDir get() = Paths.get(".").resolve(".testKitDir")
|
||||||
|
|
||||||
|
private val hashAlphabet: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')
|
||||||
|
private fun randomHash(length: Int = 15): String {
|
||||||
|
return List(length) { hashAlphabet.random() }.joinToString("")
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupProjectFromTestResources(
|
private fun setupProjectFromTestResources(
|
||||||
projectName: String,
|
projectName: String,
|
||||||
gradleVersion: GradleVersion,
|
gradleVersion: GradleVersion,
|
||||||
@@ -176,8 +181,9 @@ private fun setupProjectFromTestResources(
|
|||||||
assertTrue("Test project path is a directory") { Files.isDirectory(testProjectPath) }
|
assertTrue("Test project path is a directory") { Files.isDirectory(testProjectPath) }
|
||||||
|
|
||||||
return tempDir
|
return tempDir
|
||||||
.resolve(projectName)
|
|
||||||
.resolve(gradleVersion.version)
|
.resolve(gradleVersion.version)
|
||||||
|
.resolve(randomHash())
|
||||||
|
.resolve(projectName)
|
||||||
.resolve(optionalSubDir)
|
.resolve(optionalSubDir)
|
||||||
.also {
|
.also {
|
||||||
testProjectPath.copyRecursively(it)
|
testProjectPath.copyRecursively(it)
|
||||||
|
|||||||
Reference in New Issue
Block a user