Skip to content

Commit b94a7fe

Browse files
committed
test/framework fix docker pod log collector
When using ExecContainerInput to create the tarball, the same buffer got used for stdout and stderr. This broke the tarball which resulted in not extracting the files.
1 parent 91277b5 commit b94a7fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/framework/docker_logcollector.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package framework
1818

1919
import (
20+
"bytes"
2021
"context"
2122
"fmt"
2223
"os"
@@ -106,8 +107,10 @@ func (k DockerLogCollector) collectLogsFromNode(ctx context.Context, outputPath
106107

107108
defer os.Remove(tempfileName)
108109

110+
var execErr string
109111
execConfig := container.ExecContainerInput{
110112
OutputBuffer: f,
113+
ErrorBuffer: bytes.NewBufferString(execErr),
111114
}
112115
err = containerRuntime.ExecContainer(
113116
ctx,
@@ -116,7 +119,7 @@ func (k DockerLogCollector) collectLogsFromNode(ctx context.Context, outputPath
116119
"tar", "--hard-dereference", "--dereference", "--directory", containerDir, "--create", "--file", "-", ".",
117120
)
118121
if err != nil {
119-
return err
122+
return errors.Wrapf(err, execErr)
120123
}
121124

122125
err = os.MkdirAll(outputDir, os.ModePerm)

0 commit comments

Comments
 (0)