Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tysonnorris committed Jun 28, 2019
1 parent 91c3eb8 commit a2a1844
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class ContainerPool(instanceId: InvokerInstanceId,
}
if (!isResentFromBuffer) {
// Add this request to the buffer, as it is not there yet.
runBuffer = runBuffer.enqueue(r)
runBuffer = runBuffer.enqueue(Run(r.action, r.msg, retryLogDeadline))
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ class ContainerPoolTests

// First action is finished
containers(0).send(pool, NeedWork(warmedData())) // pool is empty again.
feed.expectMsg(MessageFeed.Processed)

// Second action should run now
containers(0).expectMsg(Remove)
containers(1).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(runMessageLarge.action, runMessageLarge.msg, Some(_)) => true
Expand Down Expand Up @@ -454,7 +452,7 @@ class ContainerPoolTests

// Action with 512 MB is finished
containers(0).send(pool, NeedWork(warmedData()))
feed.expectMsg(MessageFeed.Processed)
// feed.expectMsg(MessageFeed.Processed)

// Action 1 should start immediately
containers(0).expectMsgPF() {
Expand Down Expand Up @@ -485,7 +483,7 @@ class ContainerPoolTests

// Action 0 ist finished -> Large action should be executed now
containers(0).send(pool, NeedWork(warmedData()))
feed.expectMsg(MessageFeed.Processed)
// feed.expectMsg(MessageFeed.Processed)
containers(1).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(runMessageLarge.action, runMessageLarge.msg, Some(_)) => true
Expand All @@ -497,25 +495,22 @@ class ContainerPoolTests

// Action 1 is finished -> Action 2 and Action 3 should be executed now
containers(1).send(pool, NeedWork(warmedData()))
feed.expectMsg(MessageFeed.Processed)
containers(2).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(runMessageDifferentNamespace.action, runMessageDifferentNamespace.msg, Some(_)) => true
case Run(runMessageDifferentNamespace.action, runMessageDifferentNamespace.msg, None) => true
}
// Assert retryLogline = false to check if this request has been stored in the queue instead of retrying in the system
containers(3).expectMsg(runMessageDifferentAction)

// Action 3 is finished -> Action 4 should start
containers(3).send(pool, NeedWork(warmedData()))
feed.expectMsg(MessageFeed.Processed)
containers(4).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(runMessageDifferentEverything.action, runMessageDifferentEverything.msg, Some(_)) => true
case Run(runMessageDifferentEverything.action, runMessageDifferentEverything.msg, None) => true
}

// Action 2 and 4 are finished
containers(2).send(pool, NeedWork(warmedData()))
feed.expectMsg(MessageFeed.Processed)
containers(4).send(pool, NeedWork(warmedData()))
feed.expectMsg(MessageFeed.Processed)
}
Expand Down Expand Up @@ -740,7 +735,7 @@ class ContainerPoolTests
.canLaunch(_: ByteSize, _: Long, _: ContainerPoolConfig, _: Boolean))
.expects(memoryLimit, 0, *, false)
.returning(true)
.repeat(3)
.repeat(2)

(resMgr.addReservation(_: ActorRef, _: ByteSize)).expects(*, memoryLimit)

Expand Down Expand Up @@ -857,7 +852,11 @@ class ContainerPoolTests
//trigger buffer processing by ContainerRemoved message
pool ! ContainerRemoved

containers(0).expectMsg(run1)
containers(0).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(run1.action, run1.msg, Some(_)) => true
}

containers(0).expectMsg(run2)

}
Expand Down Expand Up @@ -897,7 +896,10 @@ class ContainerPoolTests
//trigger buffer processing by ContainerRemoved message
pool ! ResourceUpdate

containers(0).expectMsg(run1)
containers(0).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(run1.action, run1.msg, Some(_)) => true
}
containers(0).expectMsg(run2)
}
it should "release reservation on ContainerStarted" in {
Expand All @@ -913,12 +915,11 @@ class ContainerPoolTests
feed.ref,
_ => resMgr,
List(PrewarmingConfig(1, exec, memoryLimit))))
val warmed = warmedData()
(resMgr
.canLaunch(_: ByteSize, _: Long, _: ContainerPoolConfig, _: Boolean))
.expects(memoryLimit, 0, *, false)
.returning(true)
.repeat(3)
.repeat(2)

(resMgr.addReservation(_: ActorRef, _: ByteSize)).expects(*, memoryLimit)

Expand Down Expand Up @@ -992,7 +993,7 @@ class ContainerPoolTests
.canLaunch(_: ByteSize, _: Long, _: ContainerPoolConfig, _: Boolean))
.expects(memoryLimit, 0, *, false)
.returning(true)
.repeat(3)
.repeat(2)

(resMgr.addReservation(_: ActorRef, _: ByteSize)).expects(*, memoryLimit)

Expand Down Expand Up @@ -1112,7 +1113,10 @@ class ContainerPoolTests
pool ! ResourceUpdate
pool ! ResourceUpdate

containers(0).expectMsg(run1)
containers(0).expectMsgPF() {
// The `Some` assures, that it has been retried while the first action was still blocking the invoker.
case Run(run1.action, run1.msg, Some(_)) => true
}
containers(1).expectMsg(run2)

feed.expectNoMessage()
Expand Down

0 comments on commit a2a1844

Please sign in to comment.