Skip to content

Instantly share code, notes, and snippets.

@rleibman
Created October 13, 2021 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rleibman/4d895b152078a249ef8fc1d28fd201dc to your computer and use it in GitHub Desktop.
Save rleibman/4d895b152078a249ef8fc1d28fd201dc to your computer and use it in GitHub Desktop.
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