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.
49 lines
1.4 KiB
Kotlin
49 lines
1.4 KiB
Kotlin
2 years ago
|
package org.domaindrivenarchitecture.provs.server.application
|
||
2 years ago
|
|
||
2 years ago
|
import org.domaindrivenarchitecture.provs.server.application.CliK3sArgumentsParser
|
||
|
import org.domaindrivenarchitecture.provs.server.application.parseServerArguments
|
||
2 years ago
|
import org.junit.jupiter.api.Test
|
||
|
import org.junit.jupiter.api.Assertions.*
|
||
|
|
||
|
internal class CliK3sCommandKtTest {
|
||
|
|
||
|
@Test
|
||
|
fun test_parseServerArguments_are_valid_for_k3s() {
|
||
|
// when
|
||
|
val cmd = parseServerArguments(args = arrayOf("-l", "-t", "k3s"))
|
||
|
|
||
|
// then
|
||
|
assertTrue(cmd.isValid())
|
||
|
assertEquals(CliK3sArgumentsParser.K3sType.K3S, cmd.type())
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun test_parseServerArguments_are_invalid_without_target() {
|
||
|
// when
|
||
|
val cmd = parseServerArguments(args = arrayOf("-t", "k3s"))
|
||
|
|
||
|
// then
|
||
|
assertFalse(cmd.isValid())
|
||
|
assertEquals(CliK3sArgumentsParser.K3sType.K3S, cmd.type())
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun test_parseServerArguments_has_default_type_k3s() {
|
||
|
// when
|
||
|
val cmd = parseServerArguments(args = arrayOf("-l"))
|
||
|
|
||
|
// then
|
||
|
assertTrue(cmd.isValid())
|
||
|
assertEquals(CliK3sArgumentsParser.K3sType.K3S, cmd.type())
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun test_parseServerArguments_are_valid_for_k3d() {
|
||
|
// when
|
||
|
val cmd = parseServerArguments(args = arrayOf("-l", "-t", "k3d"))
|
||
|
|
||
|
// then
|
||
|
assertTrue(cmd.isValid())
|
||
|
assertEquals(CliK3sArgumentsParser.K3sType.K3D, cmd.type())
|
||
|
}
|
||
|
}
|