[skip ci] add checkPackageInstalled and refactor FirefoxKtTest.kt

This commit is contained in:
az 2023-04-21 19:16:18 +02:00
parent 2393844ef4
commit 99c02e8a48
2 changed files with 16 additions and 10 deletions

View file

@ -72,6 +72,14 @@ fun Prov.isPackageInstalled(packageName: String): Boolean {
}
/**
* Returns true if a package is installed else false
*/
fun Prov.checkPackageInstalled(packageName: String): ProvResult = taskWithResult {
cmd("dpkg -s $packageName")
}
/**
* Removes a package including its configuration and data file
*/

View file

@ -1,6 +1,6 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackageInstalled
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
@ -9,15 +9,13 @@ internal class FirefoxKtTest {
@ExtensiveContainerTest
fun installFirefox() {
defaultTestContainer().session {
// when
val res = installFirefox()
val result = defaultTestContainer().session {
installFirefox()
checkPackageInstalled("firefox")
}
// then
assertTrue(res.success)
val ffIsInstalled = isPackageInstalled("firefox")
assertTrue(ffIsInstalled)
}
assertTrue(result.success)
}
}