Skip to content

Commit 9d5343d

Browse files
committed
Increase memory limit in tests for Zip(..)
1 parent 54043e8 commit 9d5343d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

extract_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ func TestTarGzMemoryConsumption(t *testing.T) {
378378

379379
runtime.ReadMemStats(&m2)
380380
heapUsed := m2.HeapInuse - m.HeapInuse
381+
if m2.HeapInuse < m.HeapInuse {
382+
heapUsed = 0
383+
}
381384
fmt.Println("Heap memory used during the test:", heapUsed)
382385
require.True(t, heapUsed < 5000000, "heap consumption should be less than 5M but is %d", heapUsed)
383386
}
@@ -403,10 +406,13 @@ func TestZipMemoryConsumption(t *testing.T) {
403406

404407
runtime.ReadMemStats(&m2)
405408
heapUsed := m2.HeapInuse - m.HeapInuse
409+
if m2.HeapInuse < m.HeapInuse {
410+
heapUsed = 0
411+
}
406412
fmt.Println("Heap memory used during the test:", heapUsed)
407413
// the .zip file require random access, so the full io.Reader content must be cached, since
408-
// the test file is 130MB, that's the reason for the 180+ Mb of memory consumed.
409-
require.True(t, heapUsed < 200000000, "heap consumption should be less than 200M but is %d", heapUsed)
414+
// the test file is 130MB, that's the reason for the high memory consumed.
415+
require.True(t, heapUsed < 250000000, "heap consumption should be less than 250M but is %d", heapUsed)
410416
}
411417

412418
func download(t require.TestingT, url string, file *paths.Path) error {

0 commit comments

Comments
 (0)