Skip to content

Commit

Permalink
Merge pull request #284 from srdc/mapping-execution-endpoint-test-fai…
Browse files Browse the repository at this point in the history
…lure

Fix MappingExecutionEndpointTest
  • Loading branch information
dogukan10 authored Feb 6, 2025
2 parents 1af283a + 85ef2eb commit 7a8b0a0
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@ class MappingExecutionEndpointTest extends BaseEndpointTest with OnFhirTestConta
_.listFiles().headOption.map( // mapping task folder
_.listFiles())) // source folder i.e. main source, secondary source etc.
sourceFolders.isDefined && sourceFolders.get.length == 2 && {
val mainSource = sourceFolders.get.head
val mainSource = sourceFolders.get match {
case folders if folders.head.getName.contentEquals("mainSource") => folders.head
case folders => folders.last
}
val csvFile = mainSource.listFiles().head
mainSource.getName.contentEquals("mainSource") &&
// Spark initially writes data to files in the "_temporary" directory. After all tasks complete successfully,
// the files are moved from "_temporary" to the parent output directory, and "_temporary" is deleted. This
// intermediate step can be observed during testing, which is why we check if the file is a CSV.
Expand All @@ -257,9 +259,11 @@ class MappingExecutionEndpointTest extends BaseEndpointTest with OnFhirTestConta
csvFileContent.count() == 1
}
} && {
val secondarySource = sourceFolders.get.last
val secondarySource = sourceFolders.get match {
case folders if folders.last.getName.contentEquals("patientGender") => folders.last
case folders => folders.head
}
val csvFile = secondarySource.listFiles().head
secondarySource.getName.contentEquals("patientGender") &&
// Spark initially writes data to files in the "_temporary" directory. After all tasks complete successfully,
// the files are moved from "_temporary" to the parent output directory, and "_temporary" is deleted. This
// intermediate step can be observed during testing, which is why we check if the file is a CSV.
Expand Down

0 comments on commit 7a8b0a0

Please sign in to comment.