[skip ci] add checkPackageInstalled and refactor FirefoxKtTest.kt
This commit is contained in:
parent
2393844ef4
commit
99c02e8a48
2 changed files with 16 additions and 10 deletions
|
@ -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
|
* Removes a package including its configuration and data file
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
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.defaultTestContainer
|
||||||
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
||||||
import org.junit.jupiter.api.Assertions.assertTrue
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
|
@ -9,15 +9,13 @@ internal class FirefoxKtTest {
|
||||||
|
|
||||||
@ExtensiveContainerTest
|
@ExtensiveContainerTest
|
||||||
fun installFirefox() {
|
fun installFirefox() {
|
||||||
defaultTestContainer().session {
|
|
||||||
// when
|
// when
|
||||||
val res = installFirefox()
|
val result = defaultTestContainer().session {
|
||||||
|
installFirefox()
|
||||||
|
checkPackageInstalled("firefox")
|
||||||
|
}
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertTrue(res.success)
|
assertTrue(result.success)
|
||||||
|
|
||||||
val ffIsInstalled = isPackageInstalled("firefox")
|
|
||||||
assertTrue(ffIsInstalled)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue