Created
October 13, 2021 21:21
-
-
Save rleibman/4d895b152078a249ef8fc1d28fd201dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class DBTFSuiteSetRunner() extends DefaultRunnableSpec { | |
val routes: Http[ApplicationLayer & ZEnv, Throwable, Request, Response[ApplicationLayer, Nothing]] = ??? | |
val zapp: ZIO[ApplicationLayer, | |
Throwable, | |
Http[ApplicationLayer & ZEnv, Throwable, Request, Response[ApplicationLayer, Nothing]]] = | |
for { | |
_ <- log.info("Initializing routes") | |
yield routes | |
} | |
override def spec: ZSpec[Environment, Failure] = { | |
val suites = zapp.orDie.map { app => | |
for { | |
suiteInfo <- DBTFSuiteInfo.load(path, testBodyFilter) //Loaded from a file | |
path = suiteInfo.filePath | |
testLineNumbers = suiteInfo.testLineNumbers | |
suiteData = suiteInfo.suite | |
} yield suite(s"${suiteData.comment}: $path")( | |
suiteData.suite.zipWithIndex.map { | |
case (test, testIndex) => | |
testM(test.description) { | |
for { | |
resp <- | |
app( | |
Request( | |
Method.POST -> URL.fromString("/report").toOption.get, | |
headers = List.empty, | |
HttpData.CompleteData.apply(zio.Chunk.fromArray(test.request.spaces2.getBytes())) | |
) | |
) | |
} yield { | |
assert(resp.status === status.OK) | |
} | |
} @@ timeout(5.minute) | |
} * | |
) | |
} | |
val sharedLayer = new IntegrationTestLayerProvider {} | |
suiteM("Top level suite")(suites) | |
.provideSomeLayerShared[Live & Annotations](sharedLayer.fullLayer) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment