|
| 1 | +package io.viash.helpers |
| 2 | + |
| 3 | +import org.scalatest.BeforeAndAfterAll |
| 4 | +import org.scalatest.funsuite.AnyFunSuite |
| 5 | +import java.nio.file.{Files, Paths, Path} |
| 6 | + |
| 7 | +/** |
| 8 | + * Test suite for bash utility functions. |
| 9 | + * Runs all *.test.sh files in src/test/resources/io/viash/helpers/bashutils/ |
| 10 | + */ |
| 11 | +class BashUtilsTest extends AnyFunSuite with BeforeAndAfterAll { |
| 12 | + Logger.UseColorOverride.value = Some(false) |
| 13 | + |
| 14 | + private val projectRoot = Paths.get(System.getProperty("user.dir")) |
| 15 | + private val bashUtilsTestDir = projectRoot.resolve("src/test/resources/io/viash/helpers/bashutils") |
| 16 | + |
| 17 | + test("ViashParseArgumentValue") { |
| 18 | + val testScript = bashUtilsTestDir.resolve("ViashParseArgumentValue.test.sh") |
| 19 | + |
| 20 | + val result = Exec.runCatchPath( |
| 21 | + List("bash", testScript.toString), |
| 22 | + cwd = Some(projectRoot) |
| 23 | + ) |
| 24 | + |
| 25 | + assert(result.exitValue == 0, s"ViashParseArgumentValue test failed:\n${result.output}") |
| 26 | + } |
| 27 | + |
| 28 | + test("ViashCleanupRegistry") { |
| 29 | + val testScript = bashUtilsTestDir.resolve("ViashCleanupRegistry.test.sh") |
| 30 | + |
| 31 | + val result = Exec.runCatchPath( |
| 32 | + List("bash", testScript.toString), |
| 33 | + cwd = Some(projectRoot) |
| 34 | + ) |
| 35 | + |
| 36 | + assert(result.exitValue == 0, s"ViashCleanupRegistry test failed:\n${result.output}") |
| 37 | + } |
| 38 | +} |
0 commit comments