title: Scala play: H2 "HikariDataSource has been closed."
body: <p>I am trying to run my tests in an in-memory database with this code:</p>
  
  <pre><code>class MySpec extends PlaySpec with OneAppPerSuite {
  
    Databases.withInMemory(
      name = "test",
      urlOptions = Map(
        "MODE" -&gt; "MYSQL",
        "DATABASE_TO_UPPER" -&gt; "false",
        "DB_CLOSE_DELAY" -&gt; "-1"
      ),
      config = Map(
        "logStatements" -&gt; true,
        "lazyInit" -&gt; true,
        "username" -&gt; "sa",
        "password" -&gt; ""
      )
    ) { TestDb =&gt;
  
      "DataManagementController" should {"connect" in { 
          TestDb.withConnection( conn =&gt; 0 )   // do nothing, but connect
      }}
  
    }
  }
  </code></pre>
  
  <p>but I am getting this error: "HikariDataSource has been closed" before the test is executed:</p>
  
  <pre><code>[info] DataManagementController
  [info] - should connect *** FAILED ***
  [info]   java.sql.SQLException: HikariDataSource HikariDataSource (HikariPool-1) has been closed.
  [info]   at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:79)
  [info]   at play.api.db.DefaultDatabase.getConnection(Databases.scala:142)
  [info]   at play.api.db.DefaultDatabase.withConnection(Databases.scala:152)
  [info]   at play.api.db.DefaultDatabase.withConnection(Databases.scala:148)
  [info]   at ControllerSpec$$anonfun$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(ControllerSpec.scala:37)
  [info]   at ControllerSpec$$anonfun$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(ControllerSpec.scala:37)
  [info]   at ControllerSpec$$anonfun$1$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(ControllerSpec.scala:37)
  [info]   at org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22)
  [info]   at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
  [info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
  [info]   ...
  </code></pre>
  
  <p>What am I doing wrong?</p>