E2E testing and start tracking coverage - #403
Conversation
|
demo: 2025-07-21.04-14-22.mp4 |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
ready for review:) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements end-to-end (E2E) testing functionality and adds coverage tracking to the CI pipeline. The implementation introduces socket-based logging to enable real-time log monitoring during tests and adds comprehensive test infrastructure.
- Adds Unix socket logging capability for E2E test communication
- Implements E2E test framework with log parsing and command execution utilities
- Integrates coverage tracking for both unit tests and E2E tests in CI workflow
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/pkg/log/log.go | Adds socket cleanup logic in the Stop function |
| internal/pkg/log/config.go | Implements Unix socket logging configuration and connection handling |
| internal/pkg/controler/signal.go | Removes os.Exit(0) call to allow graceful shutdown |
| internal/pkg/config/config.go | Adds socket logging configuration fields |
| go.mod | Adds logfmt dependency for log parsing |
| e2e/test/nxdomain/nxdomain_test.go | E2E test for DNS resolution failure scenarios |
| e2e/test/cloudflare204/cloudflare204_test.go | E2E test for successful URL archiving |
| e2e/log/log.go | Log parsing utilities and record matching interface |
| e2e/e2e.go | Core E2E testing framework with command execution and log handling |
| cmd/cmd.go | Refactors command preparation to support E2E testing |
| .github/workflows/go.yml | Updates CI to run E2E tests and track coverage |
Comments suppressed due to low confidence (3)
e2e/test/nxdomain/nxdomain_test.go:1
- The package name 'boot' does not match the directory name 'nxdomain'. The package should be named 'nxdomain' to follow Go conventions.
package boot
e2e/test/cloudflare204/cloudflare204_test.go:1
- The package name 'boot' does not match the directory name 'cloudflare204'. The package should be named 'cloudflare204' to follow Go conventions.
package boot
e2e/test/nxdomain/nxdomain_test.go:43
- The function name 'TestCloudFlare204' doesn't match the test purpose. This test is for NXDOMAIN handling, so it should be named something like 'TestNXDomain'.
func TestCloudFlare204(t *testing.T) {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
NGTmeaty
left a comment
There was a problem hiding this comment.
Great job! This looks great and is a great start for additional end to end testing!
issue: #162
The main idea of this PR is to use logs for E2E testing, this approach doesn't require mocking anything.
The method is to start up the main Zeno program during testing and let Zeno push logs to a socket. Then the
e2etest suite connects to the socket to get the log stream and run customizableMatch()andAssert()functions to check if each log record contains expected/unexpected content.-raceand-coverageto coverZenoprogram being tested, we can'texecveorforkthe Zeno's binary to start a new process. We have to call Zeno's entry function within theTest*functions.go testcompiles allTest*functions in the same test package into a single test binary and run it in the same process. We have to write each E2E test in different packages. Otherwise, global variable reuse would cause tests to fail.Other changes: