I'm sure someone has asked this but I can't find i...
# kotest
r
I'm sure someone has asked this but I can't find it... Just upgraded to 5.0.3 and my tagging strategy to avoid running tests that need to start a docker container seems to no longer work - looks like the tests are skipped, but the listener still starts the container:
Copy code
internal class AuctionSniperEndToEndContainerTest : StringSpec({

  tags(Docker)

  listener(openfireTestContainer(Paths.get("../docker-openfire")).perSpec())
  ...
}
Where the tag is used like this:
Copy code
import io.kotest.core.Tag
import io.kotest.core.TagExpression
import io.kotest.core.TagExpression.Companion.Empty
import io.kotest.core.TagExpression.Companion.exclude
import io.kotest.core.extensions.TagExtension

object Docker : Tag()

object DockerTagExtension : TagExtension {

  override fun tags(): TagExpression =
    if (shouldRunDockerTests()) Empty else exclude(Docker)

  private fun shouldRunDockerTests() = !runningAsPartOfBuild()

  private fun runningAsPartOfBuild() = System.getenv("BUILD_SYSTEM") != null
}
s
can you make a test in one of the skipped specs
test("foo") { error("boom") }
just to make sure it is being skipped
will help me to narrow down the issue
r
Definitely skips the test
s
ok my guess is the tag isn't being used properly
how are you setting the tag
r
Calling
fun tags(vararg tags: Tag)
in the block passed to StringSpec's constructor
(See OP)
s
no I mean at runtime
to enable/disable "docker"
oh never mind I see it
r
Oh, by reading a System property - see second post.
s
ok how do you register the tag extension
r
Copy code
import io.kotest.core.config.AbstractProjectConfig

@Suppress("unused") // read by reflection
object ProjectConfig : AbstractProjectConfig() {
  override fun extensions() = listOf(DockerTagExtension)
}
s
you shouldn't need @Suppress("unused") // read by reflection on latest plugin btw
unless that wasn't released yet
the intellij plugin should be doing that for you automatically
anyway
ok this is enough for me to write a repeater
r
Thanks!
s
I clean forgot about this. Is this still happening, I guess so ?
r
Yes, it's still happening - just upgraded to 5.1.0 and still an issue
s
Ok
Sorry that i missed it
r
NP, thanks - I haven't had a chance to dig into it further I'm afraid. At a personal level it's no big deal, just a side project and even in that it was a convenience way to debug failing tests locally.
s
I'll try for 5.1.1