-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ContainerProxyTests more stable. #4289
Conversation
As the active ack is sent asynchronously in the invoker, it could happen, that the order of them is wrong in the ContainerProxyTest. This has been proven with the following debug information: apache#4278 This PR makes these tests more stable by not relying on the order of active acks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, minor nit on saving some line sand boilerplate.
acker.calls.filter(_._2.annotations.get(WhiskActivation.initTimeAnnotation).isDefined) | ||
initializedActivations should have size 1 | ||
|
||
val initRunActivation = initializedActivations.head._2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you already know that the size is 2 and you need both calls, could this be:
val (initRunActivation, runOnlyActivation) = {
// false is sorted before true
val sorted = acker.calls.sortBy(_._2.annotations.get(WhiskActivation.initTimeAnnotation).isEmpty)
sorted(0)._2, sorted(1)._2
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another nit for places where you only need one instance (didn't realize that's needed sorry)
acker.calls.filter(_._2.annotations.get(WhiskActivation.initTimeAnnotation).isDefined) | ||
initializedActivations should have size 1 | ||
|
||
initializedActivations.head._2.annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the instances where you only need one of the calls:
val initRunActivation = acker.calls.find(_._2.annotations.get(WhiskActivation.initTimeAnnotation).isDefined).getOrElse(fail("..."))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would keep consistency to the other tests that I've adapted, but then we need another check to verify that only one of the activations contains the init annotation.
So personally I'd prefer to use filter
, checking the size of the result and using head.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty then! Nice fix! 🙂
Saw another set of failure related to ContainerProxy https://scans.gradle.com/s/36yxkcjvgad6y/tests/failed |
@chetanmeh Thanks for the hint. But on the first view it looks to me, like there is a completely different root cause, compared to the problem that has been fixed here. |
As the active ack is sent asynchronously in the invoker, it could happen, that the order of them is wrong in the ContainerProxyTest. This has been proven with the following debug information: apache#4278 This PR makes these tests more stable by not relying on the order of active acks.
As the active ack is sent asynchronously in the invoker, it could happen, that the order of them is wrong in the ContainerProxyTest. This has been proven with the following debug information: #4278
This PR makes these tests more stable by not relying on the order of active acks.
Related issue and scope
My changes affect the following components
Types of changes
Checklist: