Skip to content

Commit

Permalink
Improve e2e error reporting
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Siarkowicz <[email protected]>
Co-authored-by: James Blair <[email protected]>
Co-authored-by: chao <[email protected]>
  • Loading branch information
3 people committed Jun 7, 2024
1 parent 2f216dc commit 3c56849
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/expect/expect.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (ep *ExpectProcess) ExpectFunc(ctx context.Context, f func(string) bool) (s

select {
case <-ctx.Done():
return "", fmt.Errorf("failed to find match string: %w", ctx.Err())
return "", fmt.Errorf("context done before matching log found")
case <-time.After(time.Millisecond * 10):
// continue loop
}
Expand All @@ -203,7 +203,7 @@ func (ep *ExpectProcess) ExpectFunc(ctx context.Context, f func(string) bool) (s
// NOTE: we wait readCloseCh for ep.read() to complete draining the log before acquring the lock.
case <-ep.readCloseCh:
case <-ctx.Done():
return "", fmt.Errorf("failed to find match string: %w", ctx.Err())
return "", fmt.Errorf("context done before to found matching log")
}

ep.mu.Lock()
Expand Down
6 changes: 5 additions & 1 deletion tests/framework/e2e/etcd_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ func (ep *EtcdServerProcess) Close() error {

func (ep *EtcdServerProcess) waitReady(ctx context.Context) error {
defer close(ep.donec)
return WaitReadyExpectProc(ctx, ep.proc, EtcdServerReadyLines)
err := WaitReadyExpectProc(ctx, ep.proc, EtcdServerReadyLines)
if err != nil {
return fmt.Errorf("failed to find etcd ready lines %q, err: %w", EtcdServerReadyLines, err)
}
return nil
}

func (ep *EtcdServerProcess) Config() *EtcdServerProcessConfig { return ep.cfg }
Expand Down
2 changes: 1 addition & 1 deletion tests/robustness/failpoint/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (t triggerCompact) Trigger(ctx context.Context, _ *testing.T, member e2e.Et
for {
_, rev, err = cc.Get(ctx, "/", 0)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get revision: %w", err)
}

if !t.multiBatchCompaction || rev > int64(clus.Cfg.ServerConfig.ExperimentalCompactionBatchLimit) {
Expand Down

0 comments on commit 3c56849

Please sign in to comment.