You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.4 KiB
Kotlin
67 lines
2.4 KiB
Kotlin
package org.domaindrivenarchitecture.provs.server.domain
|
|
|
|
import org.domaindrivenarchitecture.provs.framework.core.docker
|
|
import org.domaindrivenarchitecture.provs.framework.core.docker.containerExec
|
|
import org.domaindrivenarchitecture.provs.framework.core.docker.provideContainer
|
|
import org.domaindrivenarchitecture.provs.framework.core.local
|
|
import org.domaindrivenarchitecture.provs.framework.core.processors.ContainerStartMode
|
|
import org.domaindrivenarchitecture.provs.server.apple.appleConfig
|
|
import org.domaindrivenarchitecture.provs.server.apple.checkAppleService
|
|
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
|
|
import org.domaindrivenarchitecture.provs.test.tags.NonCi
|
|
import org.junit.jupiter.api.Assertions.assertTrue
|
|
import org.junit.jupiter.api.Disabled
|
|
import org.junit.jupiter.api.Test
|
|
|
|
internal class K3dKtTest {
|
|
|
|
@Test
|
|
@Disabled // remove line and execute manually as this test may take several minutes
|
|
@ContainerTest
|
|
@NonCi
|
|
fun installK3sAsContainers() {
|
|
|
|
// given
|
|
val containerName = "alpine-docker-dind"
|
|
local().task {
|
|
provideContainer(
|
|
containerName,
|
|
"yobasystems/alpine-docker:dind-amd64",
|
|
ContainerStartMode.CREATE_NEW_KILL_EXISTING, // for re-create a potentially existing container
|
|
sudo = false,
|
|
options = "--privileged"
|
|
)
|
|
|
|
// alpine does not have bash pre-installed - but bash is currently required for provs
|
|
containerExec(containerName, "sh -c \"apk add bash\"", sudo = false)
|
|
}
|
|
|
|
val result = docker(containerName, sudo = false).task {
|
|
|
|
cmd("apk update")
|
|
cmd("apk add sudo curl")
|
|
task(
|
|
"Install kubectl"
|
|
) {
|
|
sh("""
|
|
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
|
|
chmod +x ./kubectl
|
|
mv ./kubectl /usr/local/bin/kubectl
|
|
kubectl version --client
|
|
""".trimIndent())
|
|
}
|
|
|
|
|
|
// when
|
|
installK3sAsContainers()
|
|
applyK8sConfig(appleConfig())
|
|
|
|
cmd("kubectl wait --for=condition=ready --timeout=600s pod apple-app")
|
|
checkAppleService()
|
|
}
|
|
|
|
// then
|
|
assertTrue(result.success)
|
|
}
|
|
}
|