Skip to content

Commit

Permalink
Use Loki to log when building test pachd
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-uhl committed Apr 3, 2024
1 parent 7fc1f43 commit fd7e870
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/testing/testpachd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func main() {
}
clean.AddCleanup("loki", l.Close)
opt := testloki.WithTestLoki(l)
ctx = opt.MutateContext(ctx) // want to send all logs to Loki
opts = append(opts, opt)
}

Expand All @@ -87,19 +88,14 @@ func main() {
}

errCh := make(chan error)
go func(ctx context.Context) {
go func() {
defer close(errCh)
for _, opt := range opts {
if opt.MutateContext != nil {
ctx = opt.MutateContext(ctx)
}
}
if err := pd.Run(ctx); err != nil {
if !errors.Is(err, context.Canceled) {
errCh <- err
}
}
}(ctx)
}()

// Get an RPC client connected to testpachd.
pachClient, err := pd.PachClient(ctx)
Expand Down

0 comments on commit fd7e870

Please sign in to comment.