Merge pull request #1901 from akka/wip-3797-leveldb-test-cleanup-patriknw
=per #3797 Harden file deletions in persistence tests
This commit is contained in:
commit
e41ee67dc1
11 changed files with 37 additions and 24 deletions
|
|
@ -186,6 +186,6 @@ abstract class ChannelSpec(config: Config) extends AkkaSpec(config) with Persist
|
|||
}
|
||||
}
|
||||
|
||||
class LeveldbChannelSpec extends ChannelSpec(PersistenceSpec.config("leveldb", "channel"))
|
||||
class InmemChannelSpec extends ChannelSpec(PersistenceSpec.config("inmem", "channel"))
|
||||
class LeveldbChannelSpec extends ChannelSpec(PersistenceSpec.config("leveldb", "LeveldbChannelSpec"))
|
||||
class InmemChannelSpec extends ChannelSpec(PersistenceSpec.config("inmem", "InmemChannelSpec"))
|
||||
|
||||
|
|
|
|||
|
|
@ -337,5 +337,5 @@ abstract class EventsourcedSpec(config: Config) extends AkkaSpec(config) with Pe
|
|||
}
|
||||
}
|
||||
|
||||
class LeveldbEventsourcedSpec extends EventsourcedSpec(PersistenceSpec.config("leveldb", "eventsourced"))
|
||||
class InmemEventsourcedSpec extends EventsourcedSpec(PersistenceSpec.config("inmem", "eventsourced"))
|
||||
class LeveldbEventsourcedSpec extends EventsourcedSpec(PersistenceSpec.config("leveldb", "LeveldbEventsourcedSpec"))
|
||||
class InmemEventsourcedSpec extends EventsourcedSpec(PersistenceSpec.config("inmem", "InmemEventsourcedSpec"))
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ object PerformanceSpec {
|
|||
}
|
||||
}
|
||||
|
||||
class PerformanceSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "performance", serialization = "off").withFallback(ConfigFactory.parseString(PerformanceSpec.config))) with PersistenceSpec with ImplicitSender {
|
||||
class PerformanceSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "PerformanceSpec", serialization = "off").withFallback(ConfigFactory.parseString(PerformanceSpec.config))) with PersistenceSpec with ImplicitSender {
|
||||
import PerformanceSpec._
|
||||
|
||||
val warmupCycles = system.settings.config.getInt("akka.persistence.performance.cycles.warmup")
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ trait PersistenceSpec extends BeforeAndAfterEach with Cleanup { this: AkkaSpec
|
|||
/**
|
||||
* Prefix for generating a unique name per test.
|
||||
*/
|
||||
def namePrefix: String = "test"
|
||||
def namePrefix: String = system.name
|
||||
|
||||
/**
|
||||
* Creates a processor with current name as constructor argument.
|
||||
|
|
@ -52,8 +52,8 @@ object PersistenceSpec {
|
|||
akka.actor.serialize-messages = ${serialization}
|
||||
akka.persistence.publish-plugin-commands = on
|
||||
akka.persistence.journal.plugin = "akka.persistence.journal.${plugin}"
|
||||
akka.persistence.journal.leveldb.dir = "target/journal-${test}-spec"
|
||||
akka.persistence.snapshot-store.local.dir = "target/snapshots-${test}-spec/"
|
||||
akka.persistence.journal.leveldb.dir = "target/journal-${test}"
|
||||
akka.persistence.snapshot-store.local.dir = "target/snapshots-${test}/"
|
||||
""")
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,12 @@ trait Cleanup { this: AkkaSpec ⇒
|
|||
}
|
||||
|
||||
override protected def afterTermination() {
|
||||
storageLocations.foreach(FileUtils.deleteDirectory)
|
||||
storageLocations.foreach { dir ⇒
|
||||
if (dir.exists && !FileUtils.deleteQuietly(dir)) {
|
||||
println(s"Failed to delete [$dir], will try again on exit")
|
||||
FileUtils.forceDeleteOnExit(dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,6 @@ abstract class PersistentChannelSpec(config: Config) extends ChannelSpec(config)
|
|||
}
|
||||
}
|
||||
|
||||
class LeveldbPersistentChannelSpec extends PersistentChannelSpec(PersistenceSpec.config("leveldb", "persistent-channel"))
|
||||
class InmemPersistentChannelSpec extends PersistentChannelSpec(PersistenceSpec.config("inmem", "persistent-channel"))
|
||||
class LeveldbPersistentChannelSpec extends PersistentChannelSpec(PersistenceSpec.config("leveldb", "LeveldbPersistentChannelSpec"))
|
||||
class InmemPersistentChannelSpec extends PersistentChannelSpec(PersistenceSpec.config("inmem", "InmemPersistentChannelSpec"))
|
||||
|
||||
|
|
|
|||
|
|
@ -157,6 +157,6 @@ abstract class ProcessorChannelSpec(config: Config) extends AkkaSpec(config) wit
|
|||
}
|
||||
}
|
||||
|
||||
class LeveldbProcessorChannelSpec extends ProcessorChannelSpec(PersistenceSpec.config("leveldb", "channel"))
|
||||
class InmemProcessorChannelSpec extends ProcessorChannelSpec(PersistenceSpec.config("inmem", "channel"))
|
||||
class LeveldbProcessorChannelSpec extends ProcessorChannelSpec(PersistenceSpec.config("leveldb", "LeveldbProcessorChannelSpec"))
|
||||
class InmemProcessorChannelSpec extends ProcessorChannelSpec(PersistenceSpec.config("inmem", "InmemProcessorChannelSpec"))
|
||||
|
||||
|
|
|
|||
|
|
@ -346,5 +346,5 @@ abstract class ProcessorSpec(config: Config) extends AkkaSpec(config) with Persi
|
|||
}
|
||||
}
|
||||
|
||||
class LeveldbProcessorSpec extends ProcessorSpec(PersistenceSpec.config("leveldb", "processor"))
|
||||
class InmemProcessorSpec extends ProcessorSpec(PersistenceSpec.config("inmem", "processor"))
|
||||
class LeveldbProcessorSpec extends ProcessorSpec(PersistenceSpec.config("leveldb", "LeveldbProcessorSpec"))
|
||||
class InmemProcessorSpec extends ProcessorSpec(PersistenceSpec.config("inmem", "InmemProcessorSpec"))
|
||||
|
|
|
|||
|
|
@ -128,5 +128,5 @@ abstract class ProcessorStashSpec(config: Config) extends AkkaSpec(config) with
|
|||
}
|
||||
}
|
||||
|
||||
class LeveldbProcessorStashSpec extends ProcessorStashSpec(PersistenceSpec.config("leveldb", "processor-stash"))
|
||||
class InmemProcessorStashSpec extends ProcessorStashSpec(PersistenceSpec.config("inmem", "processor-stash"))
|
||||
class LeveldbProcessorStashSpec extends ProcessorStashSpec(PersistenceSpec.config("leveldb", "LeveldbProcessorStashSpec"))
|
||||
class InmemProcessorStashSpec extends ProcessorStashSpec(PersistenceSpec.config("inmem", "InmemProcessorStashSpec"))
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ object SnapshotSpec {
|
|||
}
|
||||
}
|
||||
|
||||
class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot")) with PersistenceSpec with ImplicitSender {
|
||||
class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "SnapshotSpec")) with PersistenceSpec with ImplicitSender {
|
||||
import SnapshotSpec._
|
||||
import SnapshotProtocol._
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ object SharedLeveldbJournalSpec {
|
|||
persistence {
|
||||
journal {
|
||||
plugin = "akka.persistence.journal.leveldb-shared"
|
||||
leveldb-shared.store.dir = target/shared-journal
|
||||
leveldb-shared.store.dir = target/journal-SharedLeveldbJournalSpec
|
||||
}
|
||||
snapshot-store.local.dir = target/snapshot-store
|
||||
snapshot-store.local.dir = target/snapshots-SharedLeveldbJournalSpec
|
||||
}
|
||||
remote {
|
||||
enabled-transports = ["akka.remote.netty.tcp"]
|
||||
|
|
@ -63,11 +63,19 @@ object SharedLeveldbJournalSpec {
|
|||
class SharedLeveldbJournalSpec extends AkkaSpec(SharedLeveldbJournalSpec.config) with Cleanup {
|
||||
import SharedLeveldbJournalSpec._
|
||||
|
||||
val storeSystem = ActorSystem("store", ConfigFactory.parseString(SharedLeveldbJournalSpec.config))
|
||||
val processorASystem = ActorSystem("processorA", ConfigFactory.parseString(SharedLeveldbJournalSpec.config))
|
||||
val processorBSystem = ActorSystem("processorB", ConfigFactory.parseString(SharedLeveldbJournalSpec.config))
|
||||
|
||||
override protected def afterTermination() {
|
||||
shutdown(storeSystem)
|
||||
shutdown(processorASystem)
|
||||
shutdown(processorBSystem)
|
||||
super.afterTermination()
|
||||
}
|
||||
|
||||
"A LevelDB store" can {
|
||||
"be shared by multiple actor systems" in {
|
||||
val storeSystem = ActorSystem("store", ConfigFactory.parseString(SharedLeveldbJournalSpec.config))
|
||||
val processorASystem = ActorSystem("processorA", ConfigFactory.parseString(SharedLeveldbJournalSpec.config))
|
||||
val processorBSystem = ActorSystem("processorB", ConfigFactory.parseString(SharedLeveldbJournalSpec.config))
|
||||
|
||||
val processorAProbe = new TestProbe(processorASystem)
|
||||
val processorBProbe = new TestProbe(processorBSystem)
|
||||
|
|
|
|||
|
|
@ -1184,7 +1184,7 @@ object Dependencies {
|
|||
|
||||
object Test {
|
||||
val commonsMath = "org.apache.commons" % "commons-math" % "2.1" % "test" // ApacheV2
|
||||
val commonsIo = "commons-io" % "commons-io" % "2.0.1" % "test" // ApacheV2
|
||||
val commonsIo = "commons-io" % "commons-io" % "2.4" % "test" // ApacheV2
|
||||
val commonsCodec = "commons-codec" % "commons-codec" % "1.7" % "test" // ApacheV2
|
||||
val junit = "junit" % "junit" % "4.10" % "test" // Common Public License 1.0
|
||||
val logback = "ch.qos.logback" % "logback-classic" % "1.0.13" % "test" // EPL 1.0 / LGPL 2.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue