mirror of
https://github.com/apple/container.git
synced 2026-09-26 01:25:52 +00:00
Add --max-concurrent-downloads flag for parallel layer downloads (#716)
Adds `--max-concurrent-downloads` flag to `container image pull` for configurable concurrent layer downloads. Fixes #715 Depends on apple/containerization#311 **Usage**: ```bash container image pull nginx:latest --max-concurrent-downloads 6 ``` **Changes**: - Add CLI flag (default: 3) - Thread parameter through XPC stack - Update to use forked containerization with configurable concurrency **Performance**: ~1.2-1.3x faster pulls for multi-layer images with higher concurrency **Tests**: Included standalone tests verify concurrency behavior and parameter flow --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
1e19a4d6e3
commit
f7bcb687fd
@@ -360,6 +360,41 @@ extension TestCLIImagesCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@Test func testMaxConcurrentDownloadsValidation() throws {
|
||||
// Test that invalid maxConcurrentDownloads value is rejected
|
||||
let (_, _, error, status) = try run(arguments: [
|
||||
"image",
|
||||
"pull",
|
||||
"--max-concurrent-downloads", "0",
|
||||
"alpine:latest",
|
||||
])
|
||||
|
||||
#expect(status != 0, "Expected command to fail with maxConcurrentDownloads=0")
|
||||
#expect(
|
||||
error.contains("maximum number of concurrent downloads must be greater than 0"),
|
||||
"Expected validation error message in output")
|
||||
}
|
||||
|
||||
@Test func testMaxConcurrentDownloadsFlag() throws {
|
||||
// Test that the flag is accepted with valid values
|
||||
do {
|
||||
try doPull(imageName: alpine, args: ["--max-concurrent-downloads", "1"])
|
||||
let imagePresent = try isImagePresent(targetImage: alpine)
|
||||
#expect(imagePresent, "Expected image to be pulled with maxConcurrentDownloads=1")
|
||||
|
||||
// Clean up
|
||||
try? doRemoveImages(images: [alpine])
|
||||
|
||||
// Test with higher concurrency
|
||||
try doPull(imageName: alpine, args: ["--max-concurrent-downloads", "6"])
|
||||
let imagePresent2 = try isImagePresent(targetImage: alpine)
|
||||
#expect(imagePresent2, "Expected image to be pulled with maxConcurrentDownloads=6")
|
||||
} catch {
|
||||
Issue.record("failed to pull image with maxConcurrentDownloads flag: \(error)")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@Test func testImageSaveAndLoadStdinStdout() throws {
|
||||
do {
|
||||
// 1. pull image
|
||||
|
||||
Reference in New Issue
Block a user