Skip to content

Commit

Permalink
tests: Log output per-executor
Browse files Browse the repository at this point in the history
  • Loading branch information
pbitty committed Aug 27, 2024
1 parent a6b4d2f commit dcf67a6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1163,8 +1163,6 @@ func TestIncludesRemote(t *testing.T) {
t.Setenv("FIRST_REMOTE_URL", tc.firstRemote)
t.Setenv("SECOND_REMOTE_URL", tc.secondRemote)

var buff SyncBuffer

executors := []struct {
name string
executor *task.Executor
Expand All @@ -1173,12 +1171,9 @@ func TestIncludesRemote(t *testing.T) {
name: "online, always download",
executor: &task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
Entrypoint: tc.rootTaskfile,
Timeout: time.Minute,
Insecure: true,
Logger: &logger.Logger{Stdout: &buff, Stderr: &buff, Verbose: true},
Verbose: true,

// Without caching
Expand All @@ -1191,12 +1186,10 @@ func TestIncludesRemote(t *testing.T) {
name: "offline, use-cache",
executor: &task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
Entrypoint: tc.rootTaskfile,
Timeout: time.Minute,
Insecure: true,
Logger: &logger.Logger{Stdout: &buff, Stderr: &buff, Verbose: true},
Verbose: true,

// With caching
AssumeYes: false,
Expand All @@ -1208,6 +1201,13 @@ func TestIncludesRemote(t *testing.T) {

for j, e := range executors {
t.Run(fmt.Sprint(j), func(t *testing.T) {
var buff SyncBuffer
defer func() { t.Log("\noutput:\n", buff.buf.String()) }()

e.executor.Stderr = &buff
e.executor.Stdout = &buff
e.executor.Logger = &logger.Logger{Stderr: &buff, Stdout: &buff, Verbose: true}

require.NoError(t, e.executor.Setup())

for k, task := range tasks {
Expand Down Expand Up @@ -1236,8 +1236,6 @@ func TestIncludesRemote(t *testing.T) {
}
})
}

t.Log("\noutput:\n", buff.buf.String())
})
}
}
Expand Down

0 comments on commit dcf67a6

Please sign in to comment.