[skip ci] chg Go.kt and GoKtTest.kt & other minor changes

This commit is contained in:
ansgarz 2025-02-02 19:09:57 +01:00
parent c20167c9f9
commit 75f1521814
5 changed files with 37 additions and 20 deletions
.run
src
main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure
test/kotlin/org/domaindrivenarchitecture/provs
desktop/infrastructure
framework/core/processors

View file

@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="extensive_container_tests_only" type="JUnit" factoryName="JUnit">
<module name="provs.test" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="tags" />
<option name="VM_PARAMETERS" />
<tag value="extensivecontainertest" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View file

@ -32,18 +32,15 @@ fun Prov.installGo(
if (result.success) {
cmd("tar -C /usr/local -xzf $target/go1.23.5.linux-amd64.tar.gz", sudo = true)
deleteFile("$target/$filename")
configureBashForUser()
createFile("~/.bashrc.d/go.sh", "export PATH=\$PATH:/usr/local/go/bin\n")
//cmd(". /usr/local/go/bin/go && go version")
// Cross-check if installation was successful
deleteFile("$target/$filename")
return@taskWithResult ProvResult(checkGoVersion(version))
} else {
return@taskWithResult ProvResult(false, err = "Go $version could not be installed. " + result.err)
return@taskWithResult ProvResult(false, err = "Go $version could not be downloaded and installed. " + result.err)
}
}
internal fun Prov.checkGoVersion(version: String): Boolean {
fun Prov.checkGoVersion(version: String): Boolean {
val installedGoVersion = goVersion()
return installedGoVersion != null && installedGoVersion.startsWith("go version go" + version)
}

View file

@ -1,20 +1,25 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
class GoKtTest {
@ContainerTest
fun installGo() {
// given
val container = defaultTestContainer()
// when
val res01 = container.installGo()
val res02 = container.installGo()
// then
assertTrue(res01.success)
assertTrue(res02.success)
}
@ExtensiveContainerTest
fun installGo() {
// given
val prov = defaultTestContainer()
// when
val res = prov.task {
installGo()
installGo() // check repeatability
// check if installation was successful
cmd("/usr/local/go/bin/go version")
}
// then
assertTrue(res.success)
}
}

View file

@ -8,7 +8,7 @@ import org.junit.jupiter.api.Assertions.assertTrue
internal class NpmByNvmKtTest {
@ContainerTest
fun installNVMnpm() {
fun installNpmByNvm() {
// given
val prov = defaultTestContainer()
prov.aptInstall("curl")

View file

@ -30,7 +30,7 @@ class ContainerUbuntuHostProcessorTest {
@ExtensiveContainerTest
fun test_reopeing_ssh_session_succeeds() {
fun test_reopening_ssh_session_succeeds() {
// given
val containerName = "prov-test-ssh-with-container"