(t *testing.T)
| 123 | } |
| 124 | |
| 125 | func TestCreateTarFromZip_RejectsOversizedTarOverhead(t *testing.T) { |
| 126 | t.Parallel() |
| 127 | |
| 128 | // Empty files keep the ZIP payload tiny while still forcing tar |
| 129 | // headers and end-of-archive blocks to consume output budget. |
| 130 | zipBytes := buildTestZip(t, map[string]string{ |
| 131 | "empty-a.txt": "", |
| 132 | "empty-b.txt": "", |
| 133 | }) |
| 134 | |
| 135 | zr, err := zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes))) |
| 136 | require.NoError(t, err) |
| 137 | |
| 138 | // Two empty tar entries still need 2 header blocks plus the 2 |
| 139 | // end-of-archive blocks, so the output is 2048 bytes and must |
| 140 | // exceed this limit. |
| 141 | tarBytes, err := archive.CreateTarFromZip(zr, 2047) |
| 142 | require.Error(t, err) |
| 143 | require.Nil(t, tarBytes) |
| 144 | } |
| 145 | |
| 146 | func TestCreateZipFromTar(t *testing.T) { |
| 147 | t.Parallel() |
nothing calls this directly
no test coverage detected