Skip to content
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

[v2] Change e2e jaeger-v2 binary log output to temp file #5431

Merged
merged 6 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions cmd/jaeger/internal/integration/e2e_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,21 @@
logger := zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))
configFile := createStorageCleanerConfig(t, s.ConfigFile, storage)
t.Logf("Starting Jaeger-v2 in the background with config file %s", configFile)

logFile := filepath.Join(t.TempDir(), "jaeger_logs.txt")
file, err := os.OpenFile(logFile, os.O_CREATE|os.O_WRONLY, os.ModePerm)
require.NoError(t, err)
t.Logf("Writing the Jaeger-v2 logs into %s", logFile)

cmd := exec.Cmd{
Path: "./cmd/jaeger/jaeger",
Args: []string{"jaeger", "--config", configFile},
// Change the working directory to the root of this project
// since the binary config file jaeger_query's ui_config points to
// "./cmd/jaeger/config-ui.json"
Dir: "../../../..",
Stdout: os.Stderr,
Stderr: os.Stderr,
Stdout: file,
Stderr: file,
}
require.NoError(t, cmd.Start())
require.Eventually(t, func() bool {
Expand All @@ -76,10 +82,14 @@
}, 30*time.Second, 500*time.Millisecond, "Jaeger-v2 did not start")
t.Log("Jaeger-v2 is ready")
t.Cleanup(func() {
if t.Failed() {
logs, err := os.ReadFile(logFile)
require.NoError(t, err)
t.Logf("Jaeger-v2 logs:\n%s", logs)

Check warning on line 88 in cmd/jaeger/internal/integration/e2e_integration.go

View check run for this annotation

Codecov / codecov/patch

cmd/jaeger/internal/integration/e2e_integration.go#L86-L88

Added lines #L86 - L88 were not covered by tests
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps it makes sense to configure codecov to ignore cmd/jaeger/internal/integration/

require.NoError(t, cmd.Process.Kill())
})

var err error
s.SpanWriter, err = createSpanWriter(logger, otlpPort)
require.NoError(t, err)
s.SpanReader, err = createSpanReader(ports.QueryGRPC)
Expand Down
Loading