-
Notifications
You must be signed in to change notification settings - Fork 109
eBPF unit test: add general tc ut #1362
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
Conversation
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.
Pull Request Overview
This PR enhances the eBPF unit tests by adding general TC tests for marking encryption and decryption. The key changes include adding new test files for tc_mark_encrypt and tc_mark_decrypt, updating the encryption mark value and comment for consistency, and extending the test harness in Go to run the new general TC tests.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/bpf_ut/tc_mark_encrypt_test.c | Adds unit tests for tc_mark_encrypt with updated expected mark value |
test/bpf_ut/tc_mark_decrypt_test.c | Adds unit tests for tc_mark_decrypt |
test/bpf_ut/include/tc_common.h | Introduces packet building and checking macros for TC unit tests |
test/bpf_ut/bpftest/general_test.go | Adds a new general TC test runner in Go |
test/bpf_ut/bpftest/bpf_test.go | Integrates the new GeneralTC test group into the test suite |
bpf/kmesh/general/tc_mark_encrypt.c | Updates the encryption mark value and comment to 0x00e0 for clarity |
Files not reviewed (1)
- test/bpf_ut/Makefile: Language not supported
Comments suppressed due to low confidence (2)
test/bpf_ut/include/tc_common.h:44
- The default IP header in the build_tc_packet macro uses a hard-coded destination IP (0x0100000A) that is inconsistent with the test constants (e.g. DEST_IP defined as 0x0F00010A). Consider updating the default value to match or clearly document its intended purpose if it is not expected to be used.
.daddr = bpf_htons(0x0100000A) /* 10.0.0.1 - assuming DEST_IP */
bpf/kmesh/general/tc_mark_encrypt.c:20
- Since this file is being included directly in test files, defining tc_mark_encrypt as a non-static function might lead to multiple definition issues during linking. Consider declaring it as 'static inline' to ensure proper scoping within each test compilation unit.
int tc_mark_encrypt(struct __sk_buff *ctx)
Signed-off-by: Zhenxiong Tian <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
see 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
/retest |
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.
/lgtm
[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
Needs 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:
Which issue(s) this PR fixes:
Fixes #1209
Special notes for your reviewer:
Does this PR introduce a user-facing change?: