[skip ci] fix firefox installation by allowing downgrades after having removed snap ff

This commit is contained in:
az 2023-04-30 15:31:31 +02:00
parent c9aea931b6
commit 3291fc2ccd
2 changed files with 32 additions and 1 deletions

View file

@ -38,5 +38,5 @@ fun Prov.installFirefox() = task {
) )
aptInstall("firefox") aptInstall("firefox")
cmd("apt-get upgrade -y firefox", sudo = true) cmd("apt-get upgrade -y --allow-downgrades firefox", sudo = true)
} }

View file

@ -1,12 +1,18 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.remote
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackageInstalled import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.checkPackageInstalled
import org.domaindrivenarchitecture.provs.framework.ubuntu.secret.secretSources.PromptSecretSource
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
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
internal class FirefoxKtTest { internal class FirefoxKtTest {
// Attention: this test does not test full functionality of installFirefox, e.g. does not test
// remove snap, as this test runs against a container which does not have snap-firefox installed
@ExtensiveContainerTest @ExtensiveContainerTest
fun installFirefox() { fun installFirefox() {
// when // when
@ -18,4 +24,29 @@ internal class FirefoxKtTest {
// then // then
assertTrue(result.success) assertTrue(result.success)
} }
@Test
@Disabled("Update connection details,then enable and run manually")
fun installFirefox_remotely() {
val host = "192.168.56.123"
val user = "user"
var firefoxVersion = ""
// when
val result = remote(
host,
user,
/* remove for ssh authentication */
PromptSecretSource("Remote password for user $user").secret()
).session {
installFirefox()
firefoxVersion = cmd("apt list firefox --installed").out ?: ""
checkPackageInstalled("firefox")
}
// then
assertTrue(result.success)
println("Firefox: $firefoxVersion")
assertTrue(firefoxVersion.contains("ubuntu") && !firefoxVersion.contains("snap"))
}
} }