Skip to content

Commit

Permalink
Log Expect Behavior
Browse files Browse the repository at this point in the history
Rather return the last execution expect than running expect over all
invocations of the process.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
  • Loading branch information
tjungblu committed Jun 15, 2023
1 parent ab50d80 commit 4d2a097
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/framework/e2e/etcd_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package e2e
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -387,18 +388,11 @@ type multiLogsExpect struct {
}

func (m *multiLogsExpect) ExpectWithContext(ctx context.Context, s string) (string, error) {
var lastErr error
for _, log := range m.procLogs {
r, err := log.ExpectWithContext(ctx, s)
if err != nil {
lastErr = err
continue
}

return r, nil
if len(m.procLogs) == 0 {
return "", errors.New("no process log found")
}

return "", lastErr
return m.procLogs[len(m.procLogs)-1].ExpectWithContext(ctx, s)
}

func (m *multiLogsExpect) Lines() []string {
Expand Down

0 comments on commit 4d2a097

Please sign in to comment.