Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enforce to run ZIO Tests sequentially

I want to run two integration tests sequentially. How can this be achieved in ZIO Test?

Here is the Suite:

suite("Undeploy a Package")(
    testM("There is a Package") {
      PackageDeployer.deploy(pckg) *> // first deploy
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NoContent))
    },
    testM(s"There is no Package") {
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NotFound))
    })

ZIO Test runs the two tests in parallel. Is there a way to enforce that they are run in Sequence?

like image 760
pme Avatar asked Jan 08 '20 09:01

pme


1 Answers

Yes! You can use TestAspect.sequential for that:

suite("Undeploy a Package")(
    testM("There is a Package") {
      PackageDeployer.deploy(pckg) *> // first deploy
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NoContent))
    },
    testM(s"There is no Package") {
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NotFound))
    }) @@ sequential
like image 142
Adam Fraser Avatar answered Oct 03 '22 04:10

Adam Fraser