Skip to content

Play tests failing in Eclipse only due to CacheManager being shutdown #58

@rgladwell

Description

@rgladwell

When running Scalatest integration tests for Play2 using the scalatestplus API some tests fail with the following error message:

Unable to provision, see the following errors:

1) Error in custom provider, java.lang.IllegalStateException: The CacheManager has been shut down. It can no longer be used.
 at play.api.cache.EhCacheModule.play$api$cache$EhCacheModule$$bindCache$1(Cache.scala:178):
Binding(interface net.sf.ehcache.Ehcache qualified with QualifierInstance(@play.cache.NamedCache(value=play)) to ProviderTarget(play.api.cache.NamedEhCacheProvider@7bbaf6fc)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
 while locating net.sf.ehcache.Ehcache annotated with @play.cache.NamedCache(value=play)
 at play.api.cache.EhCacheModule.play$api$cache$EhCacheModule$$bindCache$1(Cache.scala:179):
Binding(interface play.api.cache.CacheApi qualified with QualifierInstance(@play.cache.NamedCache(value=play)) to ProviderTarget(play.api.cache.NamedCacheApiProvider@381eb99)) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
 while locating play.api.cache.CacheApi annotated with @play.cache.NamedCache(value=play)
 while locating play.api.cache.CacheApi

I suspect this is a fault with scalatest-eclipse-plugin due to the fact the tests pass OK from the sbt CLI.

Tests pass successfully in Eclipse if the single, faulty suite runs on its own.

Perhaps some kind of difference in the life-cycle?

Expected result: tests should pass, as they do when you execute sbt test from the command line.

Actual result: Tests fail even though they pass from the CLI sbt.

I can't reproduce in a test case project. Neither can I provide my code (which is proprietary). But here is some example code that is very similar to the code that is failing for me: https://github.com/rgladwell/scalatest-eclipse-with-play

Workaround: Replacing OneAppPerSuite with OneAppPerTest seems to resolve the issue (but increases repetition).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions