From 0dc01b7f5fc9a9d0438c9b63f75d2d284ff568ad Mon Sep 17 00:00:00 2001 From: iko1 Date: Mon, 29 Dec 2025 17:49:17 +0200 Subject: [PATCH 1/4] Initial commit --- Sources/ContainerClient/Utility.swift | 10 +++++----- Tests/ContainerClientTests/UtilityTests.swift | 12 ++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Sources/ContainerClient/Utility.swift b/Sources/ContainerClient/Utility.swift index 85c6c7c3a..eb564f01d 100644 --- a/Sources/ContainerClient/Utility.swift +++ b/Sources/ContainerClient/Utility.swift @@ -73,14 +73,14 @@ public struct Utility { } public static func validPublishPorts(_ publishPorts: [PublishPort]) throws { - var hostPorts = Set() + var hostPorts = Set() for publishPort in publishPorts { - for index in 0.. Date: Thu, 1 Jan 2026 23:15:42 +0200 Subject: [PATCH 2/4] CR comment --- Sources/ContainerClient/Utility.swift | 2 +- Tests/ContainerClientTests/UtilityTests.swift | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/ContainerClient/Utility.swift b/Sources/ContainerClient/Utility.swift index eb564f01d..20785336d 100644 --- a/Sources/ContainerClient/Utility.swift +++ b/Sources/ContainerClient/Utility.swift @@ -76,7 +76,7 @@ public struct Utility { var hostPorts = Set() for publishPort in publishPorts { for index in publishPort.hostPort..<(publishPort.hostPort + publishPort.count) { - let hostPortKey = "\(index)/\(publishPort.protocol.rawValue)" + let hostPortKey = "\(index)/\(publishPort.proto.rawValue)" guard !hostPorts.contains(hostPortKey) else { throw ContainerizationError(.invalidArgument, message: "host ports for different publish port specs may not overlap") } diff --git a/Tests/ContainerClientTests/UtilityTests.swift b/Tests/ContainerClientTests/UtilityTests.swift index c58e28697..79b6836ae 100644 --- a/Tests/ContainerClientTests/UtilityTests.swift +++ b/Tests/ContainerClientTests/UtilityTests.swift @@ -124,6 +124,8 @@ struct UtilityTests { "8080:8080/udp", "1024-2048:1024-2048/tcp", "1024-2048:1024-2048/udp", + "8081:8081", + "8081:8081/udp", ]) #expect(result.count == 4) try Utility.validPublishPorts(result) From 9f8d93a81791b17ec4721922a5f7a1e00d8d61fa Mon Sep 17 00:00:00 2001 From: iko1 Date: Fri, 2 Jan 2026 06:25:28 +0200 Subject: [PATCH 3/4] fix formatting --- Sources/ContainerClient/Utility.swift | 2 +- Tests/ContainerClientTests/UtilityTests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ContainerClient/Utility.swift b/Sources/ContainerClient/Utility.swift index 20785336d..15e6f6513 100644 --- a/Sources/ContainerClient/Utility.swift +++ b/Sources/ContainerClient/Utility.swift @@ -1,5 +1,5 @@ //===----------------------------------------------------------------------===// -// Copyright © 2025 Apple Inc. and the container project authors. +// Copyright © 2025-2026 Apple Inc. and the container project authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/Tests/ContainerClientTests/UtilityTests.swift b/Tests/ContainerClientTests/UtilityTests.swift index 79b6836ae..8fcebd144 100644 --- a/Tests/ContainerClientTests/UtilityTests.swift +++ b/Tests/ContainerClientTests/UtilityTests.swift @@ -1,5 +1,5 @@ //===----------------------------------------------------------------------===// -// Copyright © 2025 Apple Inc. and the container project authors. +// Copyright © 2025-2026 Apple Inc. and the container project authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 51121620362acff98ba3e1f02a7abf801d2e300f Mon Sep 17 00:00:00 2001 From: iko1 Date: Fri, 2 Jan 2026 06:28:27 +0200 Subject: [PATCH 4/4] fix test --- Tests/ContainerClientTests/UtilityTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ContainerClientTests/UtilityTests.swift b/Tests/ContainerClientTests/UtilityTests.swift index 8fcebd144..032e48605 100644 --- a/Tests/ContainerClientTests/UtilityTests.swift +++ b/Tests/ContainerClientTests/UtilityTests.swift @@ -127,7 +127,7 @@ struct UtilityTests { "8081:8081", "8081:8081/udp", ]) - #expect(result.count == 4) + #expect(result.count == 6) try Utility.validPublishPorts(result) } }