fix installHugoByDeb and test_installHugoByDeb for idem-potency
This commit is contained in:
parent
ae68ce8db3
commit
5f23a17979
2 changed files with 9 additions and 6 deletions
src
main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure
test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure
|
@ -76,10 +76,14 @@ fun compareVersions(firstVersion : List<Int>, secondVersion: List<Int>) : String
|
|||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses hugo version.
|
||||
* @param hugoVersion can either be version a simple version like "1.22.33" or
|
||||
* a version string like: hugo v0.126.1-3d40ab+extended linux/amd64 BuildDate=2024-05-15T10:42:34Z VendorInfo=snap:0.126.1
|
||||
*/
|
||||
fun getHugoVersionNo(hugoVersion: String) : List<Int> {
|
||||
// hugo v0.126.1-3d40ab+extended linux/amd64 BuildDate=2024-05-15T10:42:34Z VendorInfo=snap:0.126.1
|
||||
var result = hugoVersion.split(" ")[1]
|
||||
var words = hugoVersion.split(" ")
|
||||
var result = if (words.size > 1) words[1] else words[0]
|
||||
result = result.split("-")[0].removePrefix("v")
|
||||
return result.split(".").map { it.toInt() }
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
||||
|
||||
import org.domaindrivenarchitecture.provs.framework.core.docker.exitAndRmContainer
|
||||
import org.domaindrivenarchitecture.provs.framework.core.local
|
||||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
|
@ -12,14 +10,15 @@ internal class HugoTest {
|
|||
@ExtensiveContainerTest
|
||||
fun test_installHugoByDeb() {
|
||||
// given
|
||||
local().exitAndRmContainer("provs_test")
|
||||
val prov = defaultTestContainer()
|
||||
|
||||
// when
|
||||
val res = prov.installHugoByDeb()
|
||||
val res2 = prov.installHugoByDeb() // check idem-potency
|
||||
|
||||
// then
|
||||
assertTrue(res.success)
|
||||
assertTrue(res2.success)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Reference in a new issue