-
Notifications
You must be signed in to change notification settings - Fork 553
Add --max-concurrent-downloads flag for parallel layer downloads #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
53e6c45
903beb8
2c97436
21ac59f
9659c53
b2e13d9
efa7b87
341c918
ae30d88
c905f84
2029f72
e1c03a2
3374833
b9e673a
7359006
0996e40
04c9d8e
f51d64b
5cacdd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,4 +215,11 @@ public struct Flags { | |
| @Option(name: .long, help: ArgumentHelp("Progress type (format: none|ansi)", valueName: "type")) | ||
| public var progress: ProgressType = .ansi | ||
| } | ||
|
|
||
| public struct ImageFetch: ParsableArguments { | ||
| public init() {} | ||
|
|
||
| @Option(name: .long, help: "Maximum number of concurrent layer downloads (default: 3)") | ||
|
||
| public var maxConcurrentDownloads: Int = 3 | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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("--max-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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't refer to command line arguments inside the client.
Should read "maximum number of concurrent downloads must be..."