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 14, 2022
1 parent b6c3401 commit 7fec3f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/diktat_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
mvn -B versions:set-property -Dproperty=diktat-check.version -DnewVersion=${{ env.BASE_VERSION }}-pre
- name: Run diktat snapshot via maven plugin
run: |
mvn -e -B diktat:check@diktat -Ddiktat.debug=true -Ddiktat.githubActions=true
mvn -B diktat:check@diktat -Ddiktat.debug=true -Ddiktat.githubActions=true
- name: Upload SARIF to Github using the upload-sarif action
uses: github/codeql-action/upload-sarif@v2
if: ${{ always() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import org.apache.http.impl.client.HttpClients
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.condition.DisabledOnOs
import org.junit.jupiter.api.condition.OS
import java.io.File
import java.io.FileOutputStream
import java.nio.file.Paths
Expand All @@ -15,20 +17,15 @@ import kotlin.io.path.listDirectoryEntries
import kotlin.io.path.name
import kotlin.io.path.pathString

@DisabledOnOs(OS.MAC)
class DiktatSaveSmokeTest : DiktatSmokeTestBase() {
override val isLintErrors = false
override fun fixAndCompare(
config: String,
expected: String,
test: String,
) {
// FixMe: it is necessary to fix after the correct assembly of the Save-cli for MacOs
val systemName = System.getProperty("os.name")
if (systemName.startsWith("Mac", ignoreCase = true)) {
Assertions.assertTrue(true)
} else {
saveSmokeTest(config, test)
}
saveSmokeTest(config, test)
}

/**
Expand Down Expand Up @@ -96,11 +93,11 @@ class DiktatSaveSmokeTest : DiktatSmokeTestBase() {
@JvmStatic
internal fun beforeAll() {
val diktatDir: String =
Paths.get("../diktat-ruleset/target")
.takeIf { it.exists() }
?.listDirectoryEntries()
?.single { it.name.contains("diktat") }
?.pathString ?: ""
Paths.get("../diktat-ruleset/target")
.takeIf { it.exists() }
?.listDirectoryEntries()
?.single { it.name.contains("diktat") }
?.pathString ?: ""

val diktat = File("src/test/resources/test/smoke/diktat.jar")
val diktatFrom = File(diktatDir)
Expand Down

0 comments on commit 7fec3f3

Please sign in to comment.