Commit a23932a4 authored by Ihrig, Arvid Conrad (ari)'s avatar Ihrig, Arvid Conrad (ari)
Browse files

Integrated Pipeline: added end-to-end test for graceful failure of non-existent file-trees

parent 9df20630
package eu.nomad_lab.integrated_pipeline_end_to_end_tests
import org.scalatest.AsyncWordSpec
import eu.nomad_lab.TreeType
import eu.nomad_lab.integrated_pipeline.{ Main, OutputType }
import org.scalatest.{ AsyncWordSpec, Matchers }
import eu.nomad_lab.integrated_pipeline_tests.{ EndToEnd, PendingEndToEnd }
import scala.util.Properties
* This Test Suite contains the End-to-End tests for the Integrated Pipeline that are not yet
......@@ -9,9 +16,23 @@ import org.scalatest.AsyncWordSpec
* These tests validate some basic assumptions on the generated output, but the queries made are
* simple enough to assume that the tests are independent of the parser versions.
class UnderDevelopment extends AsyncWordSpec {
class UnderDevelopment extends AsyncWordSpec with Matchers {
"The Integrated Pipeline" when {
"invoked in console mode" should {
"skip parse requests for non-existent file tree and log a warning" taggedAs (EndToEnd, PendingEndToEnd) in {
val f = new NonExistingTreeFixture(TreeType.Directory, OutputType.Json)
val output = new ByteArrayOutputStream()
Console.withOut(output) {
val finished = Main.mainWithFuture(f.generateConsoleArgumentList(Some(info))) { _ =>
//TODO: is it worth the effort to have a streaming implementation here?
val lines = output.toString.split(Properties.lineSeparator)
atLeast(1, lines) should (include("purely-imaginary") and include("not exist")
and include("skipping file tree"))
......@@ -68,6 +68,11 @@ package object integrated_pipeline_end_to_end_tests extends TestDataBuilders {
override val sample: TestTreeData = testData3
class NonExistingTreeFixture(val treeType: TreeType, val outputType: OutputType) extends Fixture {
override val numWorkers: Int = 1
override val sample: TestTreeData = TestTreeData("purely-imaginary", Map())
def assertValidityOfGeneratedJsonFiles(sample: TestTreeData, treeTask: FileTreeScanTask,
tmpResultsFolder: Path, metaInfo: MetaInfoEnv): Assertion = {
sample.candidateCalculationsWithParsers.foreach { entry =>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment