Skip to content

Commit e686384

Browse files
committed
fix test
1 parent db9d12f commit e686384

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

src/test/scala/io/viash/e2e/config_inject/MainConfigInjectSuite.scala

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MainConfigInjectSuite extends AnyFunSuite with BeforeAndAfterAll {
2323
("python", "config.vsh.yaml", "#", "'input': r'input.txt'"),
2424
// ("r", "script.vsh.R", "//", "input = \"input.txt\""), // TODO add back when `viash config inject` works for inline configs or add separate config/script combo for R
2525
("js", "config.vsh.yaml", "//", "'input': String.raw`input.txt`"),
26-
("scala", "config.vsh.yaml", "//", "Some(\"\"\"input.txt\"\"\"),"),
26+
("scala", "config.vsh.yaml", "//", "\"\"\"input.txt\"\"\""),
2727
("csharp", "config.vsh.yaml", "//", "input = @\"input.txt\""),
2828
)
2929

@@ -33,8 +33,6 @@ class MainConfigInjectSuite extends AnyFunSuite with BeforeAndAfterAll {
3333
}
3434

3535
for ((name, file, comment, expectedInputString) <- tests) {
36-
println(s"$name $file $expectedInputString")
37-
3836
test(s"config inject works for $name") {
3937
// check source file exists
4038
val configFile = destPath.resolve(s"$name/$file")
@@ -48,6 +46,7 @@ class MainConfigInjectSuite extends AnyFunSuite with BeforeAndAfterAll {
4846
// inject script
4947
TestHelper.testMain(
5048
"config", "inject",
49+
"--force",
5150
configFile.toString(),
5251
)
5352

@@ -60,25 +59,13 @@ class MainConfigInjectSuite extends AnyFunSuite with BeforeAndAfterAll {
6059
// run inject script a second time. The result should be the same as running it once (no changes that stack).
6160
TestHelper.testMain(
6261
"config", "inject",
62+
"--force",
6363
configFile.toString(),
6464
)
6565
val code2 = Source.fromFile(scriptFile.toString()).getLines().mkString("\n")
6666

67-
// these lines change each time config inject is run, clear the random number
68-
// meta_resources_dir='/tmp/viash_inject_test_languages15183647856847957861'
69-
// meta_executable='/tmp/viash_inject_test_languages15183647856847957861/test_languages'
70-
// meta_config='/tmp/viash_inject_test_languages15183647856847957861/.config.vsh.yaml'
71-
72-
// assume number is a Long, so between 1 and 20 decimal characters
73-
val code_replacements = code.replaceAll(s"inject_test_languages_$name\\d*", "")
74-
val code2_replacements = code2.replaceAll(s"inject_test_languages_$name\\d*", "")
75-
76-
assert(code.length - code_replacements.length <= 126 + (name.length+1)*3, "Stripping the paths should not cause very big differences")
77-
assert(code.length - code_replacements.length >= 66 + (name.length+1)*3, "Stripping the paths should not cause very big differences, but at least some")
78-
assert(code2.length - code2_replacements.length <= 126 + (name.length+1)*3, "Stripping the paths should not cause very big differences")
79-
assert(code2.length - code2_replacements.length >= 66 + (name.length+1)*3, "Stripping the paths should not cause very big differences, but at least some")
80-
81-
assert(code_replacements.length == code2_replacements.length, "Running config inject multiple times should not result in substantial code differences. Only the placeholder folder is different.")
67+
// Running config inject multiple times should produce identical results
68+
assert(code == code2, "Running config inject multiple times should produce identical code.")
8269
}
8370

8471
}

0 commit comments

Comments
 (0)