Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support of weaver test framework #201

Open
bwiercinski opened this issue Nov 9, 2021 · 2 comments
Open

support of weaver test framework #201

bwiercinski opened this issue Nov 9, 2021 · 2 comments

Comments

@bwiercinski
Copy link

support of weaver test framework

this framework works best when a tested code is based on cats effect.

i'm keen to contribute

@LMnet
Copy link
Contributor

LMnet commented Nov 10, 2021

Hi @bwiercinski !

We are ready for contributions and could help you with this.

A few points I want you to have in mind:

  1. New API approach (from the current scalatest integration) will be more friendly for the weaver.
  2. It looks like the weaver can share resources across suites. It's a great feature for the testcontainers. Scalatest doesn't have a normal way of sharing containers across suites, which is unfortunate. It would be cool if you could use this feature in your integration layer.

@bplommer
Copy link
Contributor

bplommer commented Mar 29, 2022

Based on quick experimentation, it looks like the following snippet is all you need - it doesn't even need anything Weaver-specific, just a resource of a running container:

package com.dimafeng.testcontainers

import cats.effect.{Resource, Sync}
import cats.syntax.all._

object ContainerResource {
  def apply[F[_], C <: Container](container: F[C])(implicit F: Sync[F]): Resource[F, C] =
    Resource.make(container.flatTap {
      container =>
        F.blocking(container.start())
    })(c => F.blocking(c.stop()))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants