[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 result = defaultTestContainer().session {
|
||||||
val res = installFirefox()
|
installFirefox()
|
||||||
|
checkPackageInstalled("firefox")
|
||||||
// then
|
|
||||||
assertTrue(res.success)
|
|
||||||
|
|
||||||
val ffIsInstalled = isPackageInstalled("firefox")
|
|
||||||
assertTrue(ffIsInstalled)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertTrue(result.success)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue