chore: ut coverage for same src/dst but different direction#1399
chore: ut coverage for same src/dst but different direction#1399kmesh-bot merged 1 commit intokmesh-net:mainfrom
Conversation
Signed-off-by: Yash Patel <yp969803@gmail.com>
|
@hzxuzhonghu can u review !! |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances unit test coverage by adding tests for cases where the same source/destination pair use different communication directions and by refactoring the metric request structure. Key changes include updating test cases in metric_test.go to include a “direction” field in connectionSrcDst, removing the redundant direction field from requestMetric in metric.go, and updating switch statements to reference the new nested field.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/controller/telemetry/metric_test.go | Added direction fields in various test cases to cover both inbound and outbound scenarios and updated expected reporter labels accordingly |
| pkg/controller/telemetry/metric.go | Removed redundant direction field from requestMetric and modified functions to reference connectionSrcDst.direction |
| dst: [4]uint32{nets.ConvertIpToUint32("10.19.25.31"), 0, 0, 0}, | ||
| dstPort: uint16(8000), | ||
| srcPort: uint16(8000), | ||
| direction: uint32(2), |
There was a problem hiding this comment.
Consider replacing the numeric literal 'uint32(2)' with a named constant (such as constants.INBOUND or constants.OUTBOUND) to improve code readability and consistency across tests.
Codecov ReportAll modified and coverable lines are covered by tests ✅
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
@YaoZengzeng In case you need to see the e2e failure log https://github.com/kmesh-net/kmesh/actions/runs/15027006848/job/42230150098?pr=1399 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind enhancement
What this PR does / why we need it:
ut coverage for same src/dst but different direction
Which issue(s) this PR fixes:
Fixes #1384
Special notes for your reviewer:
Does this PR introduce a user-facing change?: