-
Notifications
You must be signed in to change notification settings - Fork 53
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
[TEST]: Improvement: Switch rules/meters comparison #5740
base: develop
Are you sure you want to change the base?
Conversation
8894668
to
5944d1f
Compare
.ignoring("packetCount") | ||
.ignoring("durationSeconds") | ||
.ignoring("durationNanoSeconds")) | ||
assert rules.find { it.cookie == Cookie.SERVER_42_ISL_RTT_TURNING_COOKIE } == s42IslRttTurningRule |
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.
The same strategy was used for comparison FlowRuleEntity (EqualsAndHashCode(excludes = 'durationSeconds, durationNanoSeconds, packetCount, byteCount')
Could not use FlowEntry as the following fields are excluded:
"durationSeconds", "durationNanoSeconds", "packetCount", "byteCount", "idleTimeout", "hardTimeout", "version"
@ToString(includeNames = true) | ||
@Canonical | ||
@EqualsAndHashCode(excludes = 'durationSeconds, durationNanoSeconds, packetCount, byteCount') | ||
class FlowRuleEntity { |
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.
Added a new testing entity FlowRuleEntity that allows us to compare rules on the switch as usage of the FlowEntry excludes some required fields from verification("idleTimeout", "hardTimeout", "version").
@EqualsAndHashCode(exclude = {"durationSeconds", "durationNanoSeconds", "packetCount", "byteCount",
"idleTimeout", "hardTimeout", "version"})
FlowEntry
@@ -123,9 +122,13 @@ class MirrorEndpointsSpec extends HealthCheckSpecification { | |||
assert mirrorPointsDetails[0].status == FlowPathStatus.ACTIVE.toString().toLowerCase() | |||
assert mirrorPointsDetails[0].mirrorPointId == mirrorPointPayload.mirrorPointId | |||
} | |||
with(flow.retrieveMirrorPoints()) { | |||
points.size() == 1 | |||
expect points[0], sameBeanAs(mirrorPointPayload) |
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.
Also small updates for checking mirror details without using sameBeanAs.
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.
Great job!👍🏼
} | ||
|
||
List<FlowRuleEntity> getRules() { | ||
northboundService.getSwitchRules(switchId).flowEntries.collect { new FlowRuleEntity(it) } |
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.
From developer point of view this is quite unusual approach to have service level logic(northbound service, database) in the model classes.
I noticed that this is not the only one place in our func-test code with the similar approach, and we have similar logic in other model classes in func test packages.
Do not treat it as a call to action:)
5944d1f
to
de55485
Compare
de55485
to
8d78f56
Compare
No description provided.