[skip ci] refactor deprecated method & move version check to installation
This commit is contained in:
parent
f33ce834f9
commit
c3e53b5ce9
4 changed files with 7 additions and 10 deletions
src
main/kotlin/org/domaindrivenarchitecture/provs
test/kotlin/org/domaindrivenarchitecture/provs
|
@ -35,6 +35,8 @@ fun Prov.installGo(
|
|||
deleteFile("$target/$filename")
|
||||
configureBashForUser()
|
||||
createFile("~/.bashrc.d/go.sh", "export PATH=\$PATH:/usr/local/go/bin\n")
|
||||
// check and assert installation
|
||||
addResult(checkGoVersion(version), info = "Go version $version has been installed.")
|
||||
} else {
|
||||
return@taskWithResult ProvResult(false, err = "Go $version could not be downloaded and installed. " + result.err)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base
|
|||
|
||||
import org.domaindrivenarchitecture.provs.desktop.domain.KnownHost
|
||||
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.framework.core.local
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.*
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.SshKeyPair
|
||||
|
@ -53,11 +52,9 @@ fun Prov.addKnownHost(knownHost: KnownHost, verifyKeys: Boolean = false) = task
|
|||
val formattedHost = formatHostForKnownHostsFile(hostName, port)
|
||||
addTextToFile("\n$formattedHost $key\n", File(knownHostsFile))
|
||||
} else {
|
||||
addResultToEval(
|
||||
ProvResult(
|
||||
false,
|
||||
err = "The following key of host [$hostName] could not be verified successfully: " + key
|
||||
)
|
||||
addResult(
|
||||
false,
|
||||
err = "The following key of host [$hostName] could not be verified successfully: " + key
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ class GoKtTest {
|
|||
val res = prov.task {
|
||||
installGo()
|
||||
installGo() // check repeatability
|
||||
// check if installation was successful
|
||||
cmd("/usr/local/go/bin/go version")
|
||||
}
|
||||
|
||||
// then
|
||||
|
|
|
@ -532,7 +532,7 @@ internal class ProvTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun addResultToEval_success() {
|
||||
fun addResult_success() {
|
||||
// given
|
||||
fun Prov.inner() {
|
||||
addResult(true)
|
||||
|
@ -589,7 +589,7 @@ internal class ProvTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun addResultToEval_failure() {
|
||||
fun addResult_failure() {
|
||||
// given
|
||||
fun Prov.inner() {
|
||||
addResult(false)
|
||||
|
|
Loading…
Add table
Reference in a new issue