Skip to content

Commit

Permalink
Capture stderr to catch the ns_power deprecation warning (#688)
Browse files Browse the repository at this point in the history
* Capture stderr to catch the ns_power deprecation warning

The component is meant to be deprecated but it "spams" GHA (with 1 message per run).

* fill in pr #
  • Loading branch information
Grifs authored Apr 24, 2024
1 parent ff7d939 commit dea2f5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ TODO add summary

* `viash test`: Fix Docker id between build and test components not being consistent when using a custom Docker registry (PR #679).

* `MainNSBuildNativeSuite`: Capture the error message when reading the configs so we can capture the expected warning message (PR #688).
While almost all tests were already cleanly capturing their expected warning/error messages, this one was still remaining, resulting in warnings being shown in the output.

# Viash 0.9.0-RC2 (2024-02-23): Restructure the config and change some default values

The `.functionality` layer has been removed from the config and all fields have been moved to the top layer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.scalatest.funsuite.AnyFunSuite
import java.io.File
import java.nio.file.Paths
import scala.io.Source
import java.io.ByteArrayOutputStream

class MainNSBuildNativeSuite extends AnyFunSuite with BeforeAndAfterAll{
Logger.UseColorOverride.value = Some(false)
Expand Down Expand Up @@ -65,7 +66,12 @@ class MainNSBuildNativeSuite extends AnyFunSuite with BeforeAndAfterAll{
for ((component, _, _, _) <- components) {
test(s"Check whether particular keywords can be found in the usage with component $component") {
val configFile = getClass.getResource(s"/testns/src/$component/config.vsh.yaml").getPath
val config = Config.read(configFile)
val errStream = new ByteArrayOutputStream()
val config = Console.withErr(errStream) {
Config.read(configFile)
}
val errString = errStream.toString
assert(errString.isEmpty() || errString.matches("Warning: The status of the component 'ns_power' is set to deprecated.\\s*"))

val stdout =
Exec.run(
Expand Down

0 comments on commit dea2f5b

Please sign in to comment.