Browse Source

Another try at fixing Linux tests

pull/387/head
Alexey Tsvetkov 4 years ago committed by Alexey Tsvetkov
parent
commit
d758b6b476
  1. 21
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/DesktopApplicationTest.kt

21
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/DesktopApplicationTest.kt

@ -1,5 +1,6 @@
package org.jetbrains.compose
import org.gradle.internal.impldep.org.testng.Assert
import org.gradle.testkit.runner.TaskOutcome
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
@ -56,11 +57,21 @@ class DesktopApplicationTest : GradlePluginTestBase() {
OS.Windows -> "msi"
OS.MacOS -> "dmg"
}
val fileName =
if (currentOS == OS.Linux && ext == "deb") "testpackage_1.0-1_amd64"
else "TestPackage-1.0"
file("build/compose/binaries/main/$ext/$fileName.$ext")
.checkExists()
val packageDir = file("build/compose/binaries/main/$ext")
val packageDirFiles = packageDir.listFiles() ?: arrayOf()
check(packageDirFiles.size == 1) {
"Expected single package in $packageDir, got [${packageDirFiles.joinToString(", ") { it.name }}]"
}
val packageFile = packageDirFiles.single()
if (currentOS == OS.Linux) {
val expectedName = "testpackage_1.0-1_amd64.$ext"
check(packageFile.name.equals(expectedName, ignoreCase = true)) {
"Expected '$expectedName' package in $packageDir, got '${packageFile.name}'"
}
} else {
Assert.assertEquals(packageFile.name, "TestPackage-1.0.$ext", "Unexpected package name")
}
assertEquals(TaskOutcome.SUCCESS, result.task(":package${ext.capitalize()}")?.outcome)
assertEquals(TaskOutcome.SUCCESS, result.task(":package")?.outcome)
}

Loading…
Cancel
Save