Skip to content
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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

yuliiamir
Copy link
Collaborator

No description provided.

@yuliiamir yuliiamir force-pushed the test/entities-comparison_flow-rule-entity branch 2 times, most recently from 8894668 to 5944d1f Compare September 26, 2024 14:10
.ignoring("packetCount")
.ignoring("durationSeconds")
.ignoring("durationNanoSeconds"))
assert rules.find { it.cookie == Cookie.SERVER_42_ISL_RTT_TURNING_COOKIE } == s42IslRttTurningRule
Copy link
Collaborator Author

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 {
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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.

Copy link
Collaborator

@IvanChupin IvanChupin left a 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) }
Copy link
Collaborator

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:)

@yuliiamir yuliiamir force-pushed the test/entities-comparison_flow-rule-entity branch from 5944d1f to de55485 Compare October 14, 2024 09:22
@yuliiamir yuliiamir force-pushed the test/entities-comparison_flow-rule-entity branch from de55485 to 8d78f56 Compare October 22, 2024 13:37
@yuliiamir yuliiamir changed the title [TEST]: Improvement: Switch Rules Comparison(discrepancies collection) [TEST]: Improvement: Switch rules/meters comparison Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants