Skip to content

Commit

Permalink
CI: expose test logs
Browse files Browse the repository at this point in the history
Needed to debug test failures
  • Loading branch information
miki committed Feb 2, 2023
1 parent b3a5d61 commit ae7f595
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/go.yml
Expand Up @@ -26,3 +26,10 @@ jobs:
- name: Test
run: |
./goclean.sh
- name: Upload logs if tests failed
if: failure()
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{matrix.go}}-test-logs
path: /tmp/br*

14 changes: 13 additions & 1 deletion internal/e2etests/e2e_test.go
Expand Up @@ -189,8 +189,20 @@ func (ts *testScaffold) newClientWithOpts(name string, rootDir string,
logBknd := func(subsys string) slog.Logger { return slog.Disabled }
if ts.showLog {
logBknd = testutils.TestLoggerBackend(ts.t, name)
dbLog = logBknd("FSDB")
} else {
logf, err := os.Create(filepath.Join(rootDir, "applog.log"))
if err != nil {
ts.t.Fatalf("unable to create log file: %v", err)
}
bknd := slog.NewBackend(logf)
logBknd = func(subsys string) slog.Logger {
logger := bknd.Logger(subsys)
logger.SetLevel(slog.LevelTrace)
return logger
}
ts.t.Cleanup(func() { logf.Close() })
}
dbLog = logBknd("FSDB")

idIniter := func(context.Context) (*zkidentity.FullIdentity, error) {
c := new(zkidentity.FullIdentity)
Expand Down

0 comments on commit ae7f595

Please sign in to comment.