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.
54 lines
1.6 KiB
Kotlin
54 lines
1.6 KiB
Kotlin
package org.domaindrivenarchitecture.provs.extensions.workplace
|
|
|
|
import org.domaindrivenarchitecture.provs.core.Password
|
|
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
|
|
import org.junit.jupiter.api.Assertions.assertTrue
|
|
import org.junit.jupiter.api.Test
|
|
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
|
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
|
|
|
|
internal class ProvisionWorkplaceKtTest {
|
|
|
|
@Test
|
|
fun provisionWorkplace() {
|
|
// given
|
|
val a = defaultTestContainer()
|
|
|
|
// when
|
|
// in order to test WorkplaceType.OFFICE: fix installing libreoffice for a fresh container as it hangs the first time but succeeds 2nd time
|
|
val res = a.provisionWorkplace(
|
|
WorkplaceType.MINIMAL,
|
|
gitUserName = "testuser",
|
|
gitEmail = "testuser@test.org",
|
|
userPassword = Password("testuser")
|
|
)
|
|
|
|
// then
|
|
assertTrue(res.success)
|
|
}
|
|
|
|
|
|
@Test
|
|
fun provisionWorkplaceFromConfigFile() {
|
|
// given
|
|
val a = defaultTestContainer()
|
|
|
|
// when
|
|
// in order to test WorkplaceType.OFFICE: fix installing libreoffice for a fresh container as it hangs the first time but succeeds 2nd time
|
|
val config = getConfig("src/test/resources/WorkplaceConfigExample.json")
|
|
?: throw Exception("Could not read WorkplaceConfig")
|
|
val res = a.provisionWorkplace(
|
|
config.type,
|
|
config.ssh?.keyPair(),
|
|
config.gpg?.keyPair(),
|
|
config.gitUserName,
|
|
config.gitEmail,
|
|
)
|
|
|
|
// then
|
|
assertTrue(res.success)
|
|
}
|
|
}
|
|
|
|
|