Skip to content

Commit

Permalink
Migrate diktat smoke tests to SAVE-cli mechanism
Browse files Browse the repository at this point in the history
### What's done:
* migrated diktat smoke tests to SAVE-cli mechanism
Closes #1383
  • Loading branch information
Cheshiriks committed Jul 11, 2022
1 parent 289e135 commit abcdb8f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions diktat-rules/src/test/kotlin/org/cqfn/diktat/util/FixTestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ open class FixTestBase(
else -> ""
}

private fun getProcessBuilder(expectedPath: String, testPath: String) = when {
System.getProperty("os.name").startsWith("Linux", ignoreCase = true) -> ProcessBuilder("chmod", "777", "src/test/resources/test/smoke/${getSaveForCurrentOs()}", "&", "src/test/resources/test/smoke/${getSaveForCurrentOs()}", "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath)
System.getProperty("os.name").startsWith("Mac", ignoreCase = true) -> ProcessBuilder("chmod", "777", "src/test/resources/test/smoke/${getSaveForCurrentOs()}", "&", "src/test/resources/test/smoke/${getSaveForCurrentOs()}", "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath)
else -> ProcessBuilder("src/test/resources/test/smoke/${getSaveForCurrentOs()}", "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath)
private fun getProcessBuilder(expectedPath: String, testPath: String): ProcessBuilder {
val saveDir = "src/test/resources/test/smoke/${getSaveForCurrentOs()}"
val systemName = System.getProperty("os.name")
return when {
systemName.startsWith("Linux", ignoreCase = true) || systemName.startsWith("Mac", ignoreCase = true) ->
ProcessBuilder("chmod", "777", saveDir, "&", saveDir, "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath)
else -> ProcessBuilder(saveDir, "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath)
}
}

private fun downloadFile(url: String, file: File) {
Expand Down
2 changes: 1 addition & 1 deletion diktat-rules/src/test/resources/test/smoke/save.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[general]
execCmd="java -jar ktlint -R diktat.jar"
execCmd="chmod 777 ktlint & chmod 777 diktat.jar & java -jar ktlint -R diktat.jar"
tags = ["smokeTest"]
description = "SmokeTest"
suiteName = "SmokeTest"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[general]
execCmd="java -jar ktlint -R diktat.jar"
execCmd="chmod 777 ktlint & chmod 777 diktat.jar & java -jar ktlint -R diktat.jar"
tags = ["smokeTest"]
description = "SmokeTest"
suiteName = "SmokeTest"
Expand Down

0 comments on commit abcdb8f

Please sign in to comment.