chetanmeh commented on a change in pull request #4590: update lastUse timestamp
when advancing ContainerProxy instances in use
URL: https://github.com/apache/openwhisk/pull/4590#discussion_r316971655
##########
File path:
tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
##########
@@ -1109,6 +1108,61 @@ class ContainerProxyTests
store.calls should have size 1
}
}
+ it should "reset the lastUse and increment the activationCount on nextRun()"
in {
+ //NoData/MemoryData/PrewarmedData always reset activation count to 1, and
reset lastUse
+ val noData = NoData()
+ noData.nextRun(Run(action, message)) should matchPattern {
+ case WarmingColdData(message.user.namespace.name, action, _, 1) =>
+ }
+
+ val memData = MemoryData(action.limits.memory.megabytes.MB)
+ memData.nextRun(Run(action, message)) should matchPattern {
+ case WarmingColdData(message.user.namespace.name, action, _, 1) =>
+ }
+ val pwData = PreWarmedData(new TestContainer(), action.exec.kind,
action.limits.memory.megabytes.MB)
+ pwData.nextRun(Run(action, message)) should matchPattern {
+ case WarmingData(pwData.container, message.user.namespace.name, action,
_, 1) =>
+ }
+
+ //WarmingData, WarmingColdData, and WarmedData increment counts and reset
lastUse
+ val timeDiffSeconds = 20
+ val initialCount = 10
+ //WarmingData
+ val warmingData = WarmingData(
+ pwData.container,
+ message.user.namespace.name,
+ action,
+ Instant.now.minusSeconds(timeDiffSeconds),
Review comment:
Neat way to test time related logic!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services