refactor: extract test cert generation into a shared helper#1569
refactor: extract test cert generation into a shared helper#1569linkvt merged 1 commit intokedacore:mainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR refactors TLS test certificate generation into a shared Go helper and updates HTTP server/test code to use in-memory certs (reducing reliance on Makefile-generated files).
Changes:
- Add
pkg/testutilhelpers to generate self-signed cert/key PEM andtls.Certificatein tests. - Refactor
pkg/httpserver startup to serve from a provided listener (and adjust tests to use ephemeral ports + in-memory TLS). - Update Makefile and
.gitignoresomake testno longer depends on generating local cert files, while keeping legacy e2e cert targets.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/testutil/cert.go | New shared test helper for self-signed TLS cert generation. |
| pkg/http/server.go | Serve via net.Listener (Serve/ServeTLS) instead of ListenAndServe*. |
| pkg/http/server_test.go | Switch tests to ephemeral listeners and testutil-generated certs. |
| interceptor/tls_config_test.go | Replace duplicated cert PEM generator with testutil.GenerateCertPEM. |
| Makefile | Remove test dependency on test-certs; keep legacy cert targets with TODOs. |
| .gitignore | Stop ignoring *.crt/*.pem/... globally; ignore only /certs/ for legacy e2e. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9d9dbd3 to
b5a525e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b5a525e to
f020b36
Compare
Move inline cert generation to pkg/testutil and use in-memory certs instead of file-based ones from Makefile. Signed-off-by: Vincent Link <[email protected]>
f020b36 to
df05201
Compare
|
WIP seems to have some problems as indicated by issues in the WIP app repo, will probably replace it with the action and temporarily disable meanwhile. |
Move inline cert generation to pkg/testutil and use in-memory certs instead of file-based ones from Makefile.
Also improve the
ServeContexttests by not requiringlocalhost:1234to be available and using an unallocated port instead.Checklist