Make WPAD and DHCP tests not reliant on NPM#126
Conversation
985ce1a to
c420d09
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #126 +/- ##
==========================================
+ Coverage 58.57% 63.83% +5.26%
==========================================
Files 32 34 +2
Lines 2607 2912 +305
Branches 526 546 +20
==========================================
+ Hits 1527 1859 +332
+ Misses 745 707 -38
- Partials 335 346 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR removes the Node/Yarn-based WPAD/DHCP test infrastructure and replaces it with native unit-testable helpers plus new GoogleTest coverage, aiming to eliminate NPM-related security alerts from CI while still validating WPAD behavior.
Changes:
- Refactors WPAD DNS logic to generate candidate URLs via a helper (
wpad_dns_get_urls) and adds a test-only fetch hook for deterministic unit tests. - Extracts DHCP parsing structures/constants into a private header and exposes selected helpers to tests via
PROXYRES_TESTING/PROXYRES_TESTABLE. - Deletes Yarn/NPM test assets and updates CI workflows to run without Node (uses Python’s
http.server).
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| wpad_dns.h | Adds URL list + test hook APIs for WPAD DNS. |
| wpad_dns.c | Implements URL generation/freeing and swaps DNS fetch loop to iterate generated URLs; adds test fetch indirection. |
| wpad_dhcp_posix_p.h | New private header for DHCP message layout/constants and (test-only) helper declarations. |
| wpad_dhcp_posix.c | Switches DHCP helper functions to PROXYRES_TESTABLE for unit testing and moves constants/types to the private header. |
| testing.h | Introduces PROXYRES_TESTABLE macro to toggle internal helper visibility under tests. |
| test/yarn.lock | Removes Yarn lockfile (Node dependency removal). |
| test/package.json | Removes Node/Yarn dependency manifest. |
| test/http_server_cmd.js | Removes Yarn/pm2-based HTTP server wrapper. |
| test/dhcp_server_cmd.js | Removes Yarn/pm2-based DHCP server wrapper. |
| test/dhcp_server.js | Removes Node-based DHCP server implementation. |
| test/test_wpad.cc | Removes prior integration-style WPAD tests that depended on external environment/DHCP server. |
| test/test_wpad_dns.cc | Adds unit tests for URL generation. |
| test/test_wpad_dns_fetch.cc | Adds unit tests for DNS WPAD fetch iteration via injected fetch function. |
| test/test_wpad_dhcp.cc | Adds unit tests for DHCP option parsing/building helpers. |
| test/CMakeLists.txt | Registers new tests and enables PROXYRES_TESTING for the gtest target. |
| CMakeLists.txt | Adds headers and enables PROXYRES_TESTING for the proxyres library when building tests. |
| .github/workflows/ubuntu.yaml | Removes Node install; starts Python HTTP server; runs full test suite; changes triggers. |
| .github/workflows/macos.yaml | Removes Node install; starts Python HTTP server; runs full test suite; changes triggers. |
| .github/workflows/win32.yaml | Removes Node install; starts Python HTTP server; runs full test suite; changes triggers. |
| .github/workflows/winrt.yaml | Changes triggers (no longer runs on push). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sergio-nsk
left a comment
There was a problem hiding this comment.
Additional comments to Copilot.
c420d09 to
987d5c7
Compare
8cb44d1 to
591b914
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 20 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
591b914 to
2b2935f
Compare
55f1048 to
0bab71e
Compare
I'm tired of all the
npmsecurity alerts for a testing framework.