Browse code

Correctly close generated benchmark archives

Another update to TarSum tests, this patch fixes an issue where
the benchmarks were generating archives incorrectly by not closing
the tarWriter.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Josh Hawn authored on 2014/12/04 15:23:31
Showing 1 changed files
... ...
@@ -132,6 +132,7 @@ func sizedTar(opts sizedOptions) io.Reader {
132 132
 		fh = bytes.NewBuffer([]byte{})
133 133
 	}
134 134
 	tarW := tar.NewWriter(fh)
135
+	defer tarW.Close()
135 136
 	for i := int64(0); i < opts.num; i++ {
136 137
 		err := tarW.WriteHeader(&tar.Header{
137 138
 			Name: fmt.Sprintf("/testdata%d", i),