0

I'm having an issue where a particular tests fails using test-only within an sbt session, e.g

sbt
> test-only package.Test

where as running as a single command works fine. E.g

sbt 'test-only package.Test'

I wonder why the behaviour would be different?

I'm still working on a minimum example that I hope to share.

Update: This appears to be linked to instantiation of a Akka actor system. The error is boiling down to.

interface akka.actor.Scheduler is not assignable from class akka.actor.LightArrayRevolverScheduler
Oliver Shaw
  • 5,235
  • 4
  • 26
  • 35

1 Answers1

1

So this boiled down to a mis-use of actor systems.

The dodgy code boiled down to something like this as a mock withing a test

class FooSpec extends UnitSpec {
...
    val controller = new FooController {
      override lazy val actorSystem = ActorSystem("test")
    }
...
}

The correct way to do it was to use akka-testkit

class FooSpec extends TestKit(ActorSystem("test")) with UnitSpec {
...
    val controller = new FooController {
      override lazy val actorSystem = system
    }
...
}

Now the thing works everytime no matter how I envoke sbt.

Oliver Shaw
  • 5,235
  • 4
  • 26
  • 35