Skip to content

Commit

Permalink
DEVPROD-11778: Do not log warning messages for empty Evergreen test l…
Browse files Browse the repository at this point in the history
…ogs (#8358)
  • Loading branch information
julianedwards authored Oct 1, 2024
1 parent 6268d38 commit 3397e3f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
14 changes: 8 additions & 6 deletions agent/internal/taskoutput/test_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,22 @@ const testLogSpecFilename = "log_spec.yaml"
func (s testLogSpec) getParser() taskoutput.LogLineParser {
switch s.Format {
case testLogFormatTextTimestamp:
return func(data string) (log.LogLine, error) {
lineParts := strings.SplitN(strings.TrimSpace(data), " ", 2)
if len(lineParts) != 2 {
return log.LogLine{}, errors.Errorf("malformed text-timestamp log line: %s", data)
}
return func(line string) (log.LogLine, error) {
lineParts := strings.SplitN(strings.TrimSpace(line), " ", 2)

ts, err := strconv.ParseInt(lineParts[0], 10, 64)
if err != nil {
return log.LogLine{}, errors.Wrap(err, "invalid log timestamp prefix")
}

var data string
if len(lineParts) == 2 {
data = lineParts[1]
}

return log.LogLine{
Timestamp: ts,
Data: strings.TrimSuffix(lineParts[1], "\n"),
Data: data,
}, nil
}
default:
Expand Down
7 changes: 7 additions & 0 deletions agent/internal/taskoutput/test_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ func TestTestLogSpecGetParser(t *testing.T) {
_, err := parser(fmt.Sprintf("%v %s\n", time.Now(), data))
assert.Error(t, err)
})
t.Run("ParseRawLineWithJustTimestamp", func(t *testing.T) {
line, err := parser(fmt.Sprintf("%d\n", ts))
require.NoError(t, err)
assert.Zero(t, line.Priority)
assert.Equal(t, ts, line.Timestamp)
assert.Empty(t, line.Data)
})
t.Run("ParseRawLine", func(t *testing.T) {
line, err := parser(fmt.Sprintf("%d %s\n", ts, data))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (

// Agent version to control agent rollover. The format is the calendar date
// (YYYY-MM-DD).
AgentVersion = "2024-09-25c"
AgentVersion = "2024-10-01"
)

const (
Expand Down

0 comments on commit 3397e3f

Please sign in to comment.