Skip to content

Commit e65ee3a

Browse files
committed
Add StateTimeout test for Flushing state
1 parent 6225713 commit e65ee3a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/src/test/scala/org/apache/openwhisk/core/scheduler/queue/test/MemoryQueueTests.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ class MemoryQueueTests
206206
expectDurationChecking(mockEsClient, testInvocationNamespace)
207207

208208
val queueConfigWithShortTimeout =
209-
queueConfig.copy(idleGrace = 10.seconds, stopGrace = 10.milliseconds, gracefulShutdownTimeout = 10.milliseconds)
209+
queueConfig.copy(
210+
idleGrace = 10.seconds,
211+
stopGrace = 10.milliseconds,
212+
gracefulShutdownTimeout = 10.milliseconds,
213+
flushGrace = 10.milliseconds)
210214

211215
val fsm =
212216
TestFSMRef(
@@ -249,6 +253,10 @@ class MemoryQueueTests
249253
// state Running -> Flushing
250254
expectMsg(Transition(fsm, Running, Flushing))
251255
fsm.isTimerActive("StopQueue") shouldBe true
256+
257+
// wait for flushGrace time, StopQueue timer should send StateTimeout
258+
Thread.sleep(queueConfigWithShortTimeout.flushGrace.toMillis)
259+
expectMsg(Transition(fsm, Flushing, Removed))
252260
}
253261

254262
it should "register the endpoint when initializing" in {

0 commit comments

Comments
 (0)