Skip to content

Commit 3aa90d1

Browse files
committed
Move some ParallelPull integration to helper funcs
Signed-off-by: David Son <davbson@amazon.com>
1 parent 0181803 commit 3aa90d1

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

integration/pull_test.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -885,11 +885,7 @@ func TestPullWithParallelism(t *testing.T) {
885885
},
886886
{
887887
name: "set chunk size",
888-
opts: []snapshotterConfigOpt{
889-
func(cfg *config.Config) {
890-
cfg.PullModes.Parallel.ConcurrentDownloadChunkSize = 1_000_000
891-
},
892-
},
888+
opts: []snapshotterConfigOpt{withConcurrentDownloadChunkSize(1_000_000)},
893889
},
894890
}
895891

@@ -902,11 +898,7 @@ func TestPullWithParallelism(t *testing.T) {
902898
},
903899
{
904900
name: "parallel unpacking",
905-
opts: []snapshotterConfigOpt{
906-
func(cfg *config.Config) {
907-
cfg.PullModes.Parallel.MaxConcurrentUnpacks = 3
908-
},
909-
},
901+
opts: []snapshotterConfigOpt{withConcurrentUnpacks(3)},
910902
},
911903
}
912904

integration/util_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,18 @@ func withUnboundedPullUnpack() snapshotterConfigOpt {
377377
}
378378
}
379379

380+
func withConcurrentDownloadChunkSize(chunkSize int64) snapshotterConfigOpt {
381+
return func(c *config.Config) {
382+
c.PullModes.Parallel.ConcurrentDownloadChunkSize = chunkSize
383+
}
384+
}
385+
386+
func withConcurrentUnpacks(n int64) snapshotterConfigOpt {
387+
return func(c *config.Config) {
388+
c.PullModes.Parallel.MaxConcurrentUnpacks = n
389+
}
390+
}
391+
380392
func withDiscardUnpackedLayers() snapshotterConfigOpt {
381393
return func(c *config.Config) {
382394
c.PullModes.Parallel.DiscardUnpackedLayers = true

0 commit comments

Comments
 (0)