mirror of
https://gitea.com/gitea/runner.git
synced 2026-08-29 23:37:45 +00:00
feat: add log.job.dir (#1165)
`log.job.dir` makes the runner write a copy of every task's log to that directory, as `<start time>-task-<id>.log`: the rows exactly as Gitea received them, with the same masking and the job's result on the last line. Off by default, and what Gitea shows does not change. `log.job.retention` (default `168h`) and `log.job.max_size` (default `1GB`) bound the directory. Documented in the README. --------- Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1165 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com>
This commit is contained in:
@@ -1041,18 +1041,13 @@ func TestReporter_StopHeartbeats(t *testing.T) {
|
||||
"Close() must still send a final UpdateTask after StopHeartbeats")
|
||||
}
|
||||
|
||||
func TestAppendIfNotNil(t *testing.T) {
|
||||
var s []*int
|
||||
s = appendIfNotNil(s, nil)
|
||||
assert.Empty(t, s)
|
||||
|
||||
v := 7
|
||||
s = appendIfNotNil(s, &v)
|
||||
require.Len(t, s, 1)
|
||||
assert.Equal(t, &v, s[0])
|
||||
|
||||
s = appendIfNotNil(s, nil)
|
||||
require.Len(t, s, 1)
|
||||
func TestAppendLogRow(t *testing.T) {
|
||||
r := &Reporter{}
|
||||
row := &runnerv1.LogRow{Time: timestamppb.Now(), Content: "hello"}
|
||||
r.appendLogRow(nil)
|
||||
r.appendLogRow(row)
|
||||
r.appendLogRow(nil)
|
||||
assert.Equal(t, []*runnerv1.LogRow{row}, r.logRows)
|
||||
}
|
||||
|
||||
func TestReporter_Levels(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user