-
Notifications
You must be signed in to change notification settings - Fork 268
Extend api_tests to test all exported eBPF APIs with comprehensive validation #4606
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
base: main
Are you sure you want to change the base?
Conversation
api_tests to test all the exported eBPF APIsThere 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 addresses a significant gap in API test coverage by implementing comprehensive tests for all 48 exported eBPF APIs, increasing coverage from ~12% to 100%. The primary focus is ensuring that previously untested APIs are properly validated to catch regressions.
- Added 20 new comprehensive test cases covering all exported eBPF APIs in
ebpfapi/Source.def - Implemented tests for string/type APIs, verification APIs, object management, and path enumeration
- Added missing protocol handler case to support async operations without replies
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/api_test/api_test.cpp | Added 20 comprehensive test cases covering all 48 exported eBPF APIs with proper error handling and resource cleanup |
| libs/execution_context/ebpf_core.c | Added missing case for EBPF_PROTOCOL_FIXED_REQUEST_NO_REPLY_ASYNC in protocol handler properties |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
afedbb4 to
9042f82
Compare
|
@copilot please address comments |
c1c174c to
6a05dbc
Compare
libs/execution_context/unit/execution_context_unit_test_jit.cpp
Outdated
Show resolved
Hide resolved
|
@copilot please respond to latest comments |
The formatting issues in libs/execution_context/unit/execution_context_unit_test_jit.cpp and libs/runtime/ebpf_pinning_table.c were not introduced by my changes. They came from commit 7b279e9 "Make map helper functions const correct" which was merged from main into this branch. My only commit (af8e0e8) only modified tests/api_test/api_test.cpp to address the PR review comments about removing redundant checks and unnecessary nullptr checks. |
Co-authored-by: Alan-Jowett <[email protected]>
Co-authored-by: Alan-Jowett <[email protected]>
Signed-off-by: Alan Jowett <[email protected]>
Signed-off-by: Alan Jowett <[email protected]>
Signed-off-by: Alan Jowett <[email protected]>
Co-authored-by: dthaler <[email protected]>
Signed-off-by: Alan Jowett <[email protected]>
…checks Co-authored-by: dthaler <[email protected]>
2d79149 to
efe4532
Compare
Alan-Jowett
left a comment
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.
Overall, this PR does a great job adding test coverage for previously untested eBPF APIs. However, there are significant issues with the test quality that should be addressed:
Key Issues Identified:
-
Weak Validation: Many tests only check basic success/failure but don't verify the actual functionality or returned data content.
-
Missing Negative Test Cases: Most tests only cover happy paths and don't test error conditions, invalid parameters, or edge cases.
-
Conditional/Incomplete Assertions: Several tests use conditional validation (only checking results if operations succeed) which can hide functionality issues.
-
File Dependencies: Tests rely on specific test files being present without verifying their existence or using more reliable test data.
-
Tautological Assertions: Some assertions that always pass regardless of the actual behavior (already addressed in earlier comments).
Recommendations:
- Add comprehensive negative testing for all APIs with invalid parameters
- Validate actual content of returned data, not just that it's non-empty
- Test error handling paths to ensure APIs fail gracefully
- Add edge case testing (buffer overflows, null parameters, etc.)
- Make tests more deterministic by reducing dependencies on external files where possible
The added coverage is valuable, but improving test quality will make these tests much more effective at catching regressions and validating correct API behavior.
…esting Co-authored-by: Alan-Jowett <[email protected]>
Addressed all identified issues in commit 45b5420:
All tests now provide meaningful validation of actual API behavior rather than just basic success/failure checks. |
Description
Resolves: #3575
Add comprehensive tests for all 48 exported eBPF APIs that were previously untested, increasing test coverage from ~12% to 100%. This PR implements 20 new test cases with robust validation, negative testing, and edge case coverage to effectively catch regressions and validate correct API behavior.
Key Improvements
APIs Tested
Testing
CI/CD
All new tests include:
Documentation
No.
Installation
No.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.