createZipBuffer creates a zip archive in memory with the given files.
(t *testing.T, files map[string][]byte)
| 192 | |
| 193 | // createZipBuffer creates a zip archive in memory with the given files. |
| 194 | func createZipBuffer(t *testing.T, files map[string][]byte) []byte { |
| 195 | t.Helper() |
| 196 | var buf bytes.Buffer |
| 197 | zw := zip.NewWriter(&buf) |
| 198 | |
| 199 | for name, content := range files { |
| 200 | fw, err := zw.Create(name) |
| 201 | require.NoError(t, err, "failed to create zip entry") |
| 202 | _, err = fw.Write(content) |
| 203 | require.NoError(t, err, "failed to write zip content") |
| 204 | } |
| 205 | |
| 206 | require.NoError(t, zw.Close(), "failed to close zip writer") |
| 207 | return buf.Bytes() |
| 208 | } |
| 209 | |
| 210 | func TestExtractTarGz(t *testing.T) { |
| 211 | t.Run("extracts files correctly", func(t *testing.T) { |
no test coverage detected