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 5 commits
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
37 changes: 34 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,32 @@
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)

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

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

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: outFile,
Stderr: errFile,
}
require.NoError(t, cmd.Start())
require.Eventually(t, func() bool {
Expand All @@ -77,9 +94,23 @@
t.Log("Jaeger-v2 is ready")
t.Cleanup(func() {
require.NoError(t, cmd.Process.Kill())
if t.Failed() {
// A Github Actions special annotation to create a foldable section
// in the Github runner output.
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines
fmt.Println("::group::Jaeger-v2 binary logs")
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
outLogs, err := os.ReadFile(outFile.Name())
require.NoError(t, err)
fmt.Printf("Jaeger-v2 output logs:\n%s", outLogs)

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

View check run for this annotation

Codecov / codecov/patch

cmd/jaeger/internal/integration/e2e_integration.go#L101-L104

Added lines #L101 - L104 were not covered by tests

errLogs, err := os.ReadFile(errFile.Name())
require.NoError(t, err)
fmt.Printf("Jaeger-v2 error logs:\n%s", errLogs)

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

View check run for this annotation

Codecov / codecov/patch

cmd/jaeger/internal/integration/e2e_integration.go#L106-L108

Added lines #L106 - L108 were not covered by tests
// End of Github Actions foldable section annotation.
fmt.Println("::endgroup::")

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

View check run for this annotation

Codecov / codecov/patch

cmd/jaeger/internal/integration/e2e_integration.go#L110

Added line #L110 was 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/

})

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