Intellij idea Intellij idea specs2测试播放框架在多应用程序中的内存数据库演化
我正在使用specs2测试我的play应用程序。然而,我遇到了一个奇怪的问题 下面是我的测试代码(忽略中文): Intellij Idea的执行过程中一定有问题。如果我在newwithapplication中只添加一个Intellij idea Intellij idea specs2测试播放框架在多应用程序中的内存数据库演化,intellij-idea,playframework,Intellij Idea,Playframework,我正在使用specs2测试我的play应用程序。然而,我遇到了一个奇怪的问题 下面是我的测试代码(忽略中文): Intellij Idea的执行过程中一定有问题。如果我在newwithapplication中只添加一个,那么问题就消失了 我认为应该有办法解决这个问题。非常感谢您对解决方案的任何建议。提前感谢。遇到了同样的问题-这可能是intellij中的测试运行程序中的错误吗?我通过使用OneAppPerSuite特性切换到ScalateTest解决了这个问题。 class Throttlers
,那么问题就消失了
我认为应该有办法解决这个问题。非常感谢您对解决方案的任何建议。提前感谢。遇到了同样的问题-这可能是intellij中的测试运行程序中的错误吗?我通过使用OneAppPerSuite
特性切换到ScalateTest解决了这个问题。
class ThrottlersTest extends PlaySpecification with AroundTimeout {
type EE = ExecutionEnv
val apiKey = ApiKey(99, "taobao.crm.members.get")
trait ThrottlerContext extends WithApplication {
implicit val ee: EE = ExecutionEnv.create(Arguments(), org.specs2.control.consoleLogging, "test")
val throttlersRef = app.injector.instanceOf[InjectedThrottler].actor
}
"一个限速为10次每秒的限流器" should {
"在接收到第一条消息的时候应该初始化自己,并且回复Passed" in new ThrottlerContext {
await((throttlersRef ? apiKey).mapTo[Passed.type]) must equalTo(Passed)
}
"在一秒内发送11条消息时,前十条回复Passed,第11条回复Limited" in new ThrottlerContext {
upTo(1 seconds) {
for (i <- 1 to 10) {
await((throttlersRef ? apiKey).mapTo[Passed.type]) must equalTo(Passed)
}
await((throttlersRef ? apiKey).mapTo[Limited]) must beAnInstanceOf[Limited]
}
}
}
}
object ThrottlersTest {
/**
* 用来注入Throttler. 绑定关系见
* @see modules.TopModule
*/
case class InjectedThrottler @Inject()(@Named("throttlers") actor: ActorRef)
}
play.api.db.evolutions.InconsistentDatabase: Database 'default' is in an inconsistent state![An evolution has not been applied properly. Please check the problem and resolve it manually before marking it as resolved.]
@6nl3m44fd: Database 'default' is in an inconsistent state!
at play.api.db.evolutions.DatabaseEvolutions.checkEvolutionsState(EvolutionsApi.scala:269)
at play.api.db.evolutions.DatabaseEvolutions.evolve(EvolutionsApi.scala:226)