mirror of
https://github.com/apple/container.git
synced 2026-07-14 05:27:02 +00:00
Sort networks by ID in API server list(). (#1487)
Closes #1483. Consistent well-defined behavior for server APIs.
This commit is contained in:
@@ -179,6 +179,7 @@ public actor NetworksService {
|
||||
return serviceStates.reduce(into: [NetworkState]()) {
|
||||
$0.append($1.value.networkState)
|
||||
}
|
||||
.sorted { $0.id < $1.id }
|
||||
}
|
||||
|
||||
/// Create a new network from the provided configuration.
|
||||
|
||||
@@ -50,6 +50,16 @@ class TestCLINetwork: CLITest {
|
||||
defer {
|
||||
_ = try? run(arguments: networkDeleteArgs)
|
||||
}
|
||||
|
||||
let listResult = try? run(arguments: ["network", "ls", "--quiet"])
|
||||
let networkIds =
|
||||
listResult?.output
|
||||
.components(separatedBy: .newlines)
|
||||
.map { $0.trimmingCharacters(in: .whitespaces) }
|
||||
.filter({ !$0.isEmpty })
|
||||
?? ["OUTPUT MISSING"]
|
||||
#expect(networkIds == networkIds.sorted(), "network IDs should be sorted")
|
||||
|
||||
let port = UInt16.random(in: 50000..<60000)
|
||||
try doLongRun(
|
||||
name: name,
|
||||
|
||||
Reference in New Issue
Block a user