Sort networks by ID in API server list(). (#1487)

Closes #1483.
Consistent well-defined behavior for server APIs.
This commit is contained in:
J Logan
2026-04-30 15:42:04 -07:00
committed by GitHub
parent 1ee2d9d054
commit e6ba030fca
2 changed files with 11 additions and 0 deletions
@@ -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,