Add general mechanism for excluding tests

This commit is contained in:
Peter Vlugter 2011-03-31 11:36:49 +13:00
parent 511263c838
commit 804812b635
2 changed files with 15 additions and 24 deletions

View file

@ -2,7 +2,6 @@ package akka.actor
import akka.testkit.TestKit
import akka.util.duration._
import akka.Testing
import org.scalatest.WordSpec
import org.scalatest.matchers.MustMatchers
@ -17,7 +16,7 @@ class FSMTimingSpec
val fsm = Actor.actorOf(new StateMachine(testActor)).start
fsm ! SubscribeTransitionCallBack(testActor)
expectMsg(Testing.time(200).millis, CurrentState(fsm, Initial))
expectMsg(200 millis, CurrentState(fsm, Initial))
ignoreMsg {
case Transition(_, Initial, _) => true
@ -26,7 +25,7 @@ class FSMTimingSpec
"A Finite State Machine" must {
"receive StateTimeout" in {
within (Testing.time(50).millis, Testing.time(150).millis) {
within (50 millis, 150 millis) {
fsm ! TestStateTimeout
expectMsg(Transition(fsm, TestStateTimeout, Initial))
expectNoMsg
@ -34,7 +33,7 @@ class FSMTimingSpec
}
"receive single-shot timer" in {
within (Testing.time(50).millis, Testing.time(150).millis) {
within (50 millis, 150 millis) {
fsm ! TestSingleTimer
expectMsg(Tick)
expectMsg(Transition(fsm, TestSingleTimer, Initial))
@ -48,7 +47,7 @@ class FSMTimingSpec
case Tick => Tick
}
seq must have length (5)
within(Testing.time(250) millis) {
within(250 millis) {
expectMsg(Transition(fsm, TestRepeatedTimer, Initial))
expectNoMsg
}
@ -56,21 +55,21 @@ class FSMTimingSpec
"notify unhandled messages" in {
fsm ! TestUnhandled
within(Testing.time(100) millis) {
within(100 millis) {
fsm ! Tick
expectNoMsg
}
within(Testing.time(100) millis) {
within(100 millis) {
fsm ! SetHandler
fsm ! Tick
expectMsg(Unhandled(Tick))
expectNoMsg
}
within(Testing.time(100) millis) {
within(100 millis) {
fsm ! Unhandled("test")
expectNoMsg
}
within(Testing.time(100) millis) {
within(100 millis) {
fsm ! Cancel
expectMsg(Transition(fsm, TestUnhandled, Initial))
}

View file

@ -465,8 +465,6 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
}
def akkaArtifacts = descendents(info.projectPath / "dist", "*-" + version + ".jar")
lazy val integrationTestsEnabled = systemOptional[Boolean]("integration.tests",false)
lazy val stressTestsEnabled = systemOptional[Boolean]("stress.tests",false)
// ------------------------------------------------------------
class AkkaDefaultProject(info: ProjectInfo, val deployPath: Path) extends DefaultProject(info)
@ -485,21 +483,15 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
override def packageToPublishActions = super.packageToPublishActions ++ Seq(this.packageDocs, this.packageSrc)
override def pomPostProcess(node: scala.xml.Node): scala.xml.Node = mcPom(AkkaParentProject.this.moduleConfigurations)(super.pomPostProcess(node))
/**
* Used for testOptions, possibility to enable the running of integration and or stresstests
*
* To enable set true and disable set false
* set integration.tests true
* set stress.tests true
*/
def createTestFilter(defaultTests: (String) => Boolean) = { TestFilter({
case s: String if defaultTests(s) => true
case s: String if integrationTestsEnabled.value => s.endsWith("TestIntegration")
case s: String if stressTestsEnabled.value => s.endsWith("TestStress")
case _ => false
}) :: Nil
lazy val excludeTestsProperty = systemOptional[String]("akka.test.exclude", "")
def excludeTests = {
val exclude = excludeTestsProperty.value
if (exclude.isEmpty) Seq.empty else exclude.split(",").toSeq
}
override def testOptions = super.testOptions ++ excludeTests.map(exclude => TestFilter(test => !test.contains(exclude)))
lazy val publishRelease = {
val releaseConfiguration = new DefaultPublishConfiguration(localReleaseRepository, "release", false)
publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom)