[skip ci] updated test
This commit is contained in:
parent
ce122ac13a
commit
b28d03a9e0
2 changed files with 6 additions and 5 deletions
|
@ -15,7 +15,7 @@ internal fun findSpecConfigFromFile(file: ConfigFileName? = null): Result<Syspec
|
||||||
val filePath = file?.fileName ?: DEFAULT_CONFIG_FILE
|
val filePath = file?.fileName ?: DEFAULT_CONFIG_FILE
|
||||||
if ((filePath == DEFAULT_CONFIG_FILE) && !File(filePath).exists()) {
|
if ((filePath == DEFAULT_CONFIG_FILE) && !File(filePath).exists()) {
|
||||||
// use default ide config
|
// use default ide config
|
||||||
findSpecConfigFromResource("syspec/syspec-ide-config.yaml")
|
return findSpecConfigFromResource("org/domaindrivenarchitecture/provs/syspec/syspec-ide-config.yaml")
|
||||||
}
|
}
|
||||||
readFromFile(filePath).yamlToType()
|
readFromFile(filePath).yamlToType()
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,15 @@ import org.junit.jupiter.api.Test
|
||||||
internal class SyspecConfigRepoKtTest {
|
internal class SyspecConfigRepoKtTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findSpecConfigFromFile_success() {
|
fun findSpecConfigFromFile_if_default_file_is_not_found_success() {
|
||||||
// when
|
// when
|
||||||
@Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") // null would reveal test error
|
@Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") // null would reveal test error
|
||||||
val filePath = javaClass.classLoader.getResource("syspec-config.yaml").file
|
val res = findSpecConfigFromFile(ConfigFileName("syspec-config.yaml"))
|
||||||
val res = findSpecConfigFromFile(ConfigFileName(filePath))
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(listOf(CommandSpec("echo just_for_test", "just_for_test")), res.getOrNull()?.command)
|
assertEquals(
|
||||||
|
"SyspecConfig(command=[CommandSpec(command=tfenv -h, out=null), CommandSpec(command=python3 --version, out=null), CommandSpec(command=pip3 --version, out=null), CommandSpec(command=terraform --version, out=1.0.8)], file=null, folder=null, host=null, package=[PackageSpec(name=firefox, installed=true), PackageSpec(name=thunderbird, installed=true), PackageSpec(name=ssh, installed=true), PackageSpec(name=git, installed=true), PackageSpec(name=leiningen, installed=true)], netcat=null, socket=null, certificate=null)",
|
||||||
|
res.getOrNull().toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue