ファイルを取得し、特別なメタデータを使用して gridFS に保存するファイル ストレージ サービスを実装しています。もちろん、すべてが統合されていることを確認したいのですが、ファイルは実際にはデータベースに保存され、データベースから取得されます。
Play Framework 2.1.3 Scala と ReactiveMongo 0.9 を使用しています。
私のテストケースは次のようになります。
"show empty uploaded size on init" in {
running(FakeApplication()) {
Await.result(FileStorage.getFilesSize(profileId), duration) must beNone
}
}
running
すべてのケースを、またはすべてのケース、さらには でラップしようとしましたThread.sleep
。ただし、テストが失敗した後、データベースは常に稼働しています。
[error] There is no started application
[error] play.api.Play$$anonfun$current$1.apply(Play.scala:51)
[error] play.api.Play$$anonfun$current$1.apply(Play.scala:51)
[error] play.api.Play$.current(Play.scala:51)
[error] content.FileStorage$.db$lzycompute(FileStorage.scala:32)
...
[info] Total for specification FileStorageSpec
[info] Finished in 21 ms
[info] 5 examples, 1 failure, 4 errors
[info]
[info] application - ReactiveMongoPlugin starting...
[info] application - ReactiveMongoPlugin successfully started with db 'test'! Servers:
[localhost:27017]
[info] play - Starting application default Akka system.
[info] play - Shutdown application default Akka system.
私は何を間違っていますか?ReactiveMongo アプリケーションをどのようにテストしますか?