Files
docker-cli/components/engine/utils_test.go
Solomon Hykes 21e81bd668 Move all graph tests into integration, because they now rely on the underlying graph driver, which currently cannot be mocked.
Upstream-commit: fb3d60f27adba32ab60022298702a4376c1f4d0d
Component: engine
2013-11-26 05:05:15 +00:00

25 lines
644 B
Go

package docker
import (
"io"
"archive/tar"
"bytes"
)
func fakeTar() (io.Reader, error) {
content := []byte("Hello world!\n")
buf := new(bytes.Buffer)
tw := tar.NewWriter(buf)
for _, name := range []string{"/etc/postgres/postgres.conf", "/etc/passwd", "/var/log/postgres/postgres.conf"} {
hdr := new(tar.Header)
hdr.Size = int64(len(content))
hdr.Name = name
if err := tw.WriteHeader(hdr); err != nil {
return nil, err
}
tw.Write([]byte(content))
}
tw.Close()
return buf, nil
}