Skip to content

Commit 4a79060

Browse files
Ensure test filenames match test suite names and each file has a single suite defined (#1877)
This PR cleans up some of the new IntegrationTests files to ensure that each file has a single test suite defined within it and the name of the file matches the name of the test suite. Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
1 parent 69a2505 commit 4a79060

6 files changed

Lines changed: 73 additions & 55 deletions

File tree

Tests/IntegrationTests/Containers/TestCLICopy.swift renamed to Tests/IntegrationTests/Containers/TestCLICopyCommand.swift

File renamed without changes.

Tests/IntegrationTests/Containers/TestCLICreate.swift renamed to Tests/IntegrationTests/Containers/TestCLICreateCommand.swift

File renamed without changes.

Tests/IntegrationTests/Containers/TestCLIExec.swift renamed to Tests/IntegrationTests/Containers/TestCLIExecCommand.swift

File renamed without changes.

Tests/IntegrationTests/Containers/TestCLIRemove.swift

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -90,58 +90,3 @@ struct TestCLIRemove {
9090
}
9191
}
9292
}
93-
94-
/// Serial removal tests that use `delete --all` and affect global container state.
95-
@Suite(.serialized)
96-
struct TestCLIRemoveSerial {
97-
@Test func testDeleteAllStopped() async throws {
98-
try await ContainerFixture.with { f in
99-
let image = try f.copyWarmupImage(ContainerFixture.warmupImages[0])
100-
let name1 = "\(f.testID)-c1"
101-
let name2 = "\(f.testID)-c2"
102-
try f.doCreate(name: name1, image: image)
103-
f.addCleanup { try f.doRemoveIfExists(name1, ignoreFailure: true) }
104-
try f.doCreate(name: name2, image: image)
105-
f.addCleanup { try f.doRemoveIfExists(name2, ignoreFailure: true) }
106-
107-
try f.run(["delete", "--all"]).check()
108-
109-
#expect(try f.run(["inspect", name1]).status != 0, "name1 should be deleted")
110-
#expect(try f.run(["inspect", name2]).status != 0, "name2 should be deleted")
111-
}
112-
}
113-
114-
@Test func testDeleteAllSkipsRunning() async throws {
115-
try await ContainerFixture.with { f in
116-
let image = try f.copyWarmupImage(ContainerFixture.warmupImages[0])
117-
let runningName = "\(f.testID)-running"
118-
let stoppedName = "\(f.testID)-stopped"
119-
120-
try f.doLongRun(name: runningName, image: image, autoRemove: false)
121-
f.addCleanup {
122-
try? f.doStop(runningName)
123-
try? f.doRemove(runningName)
124-
}
125-
try f.doCreate(name: stoppedName, image: image)
126-
f.addCleanup { try f.doRemoveIfExists(stoppedName, ignoreFailure: true) }
127-
128-
try f.run(["delete", "--all"]).check()
129-
130-
#expect(try f.getContainerStatus(runningName) == "running", "running container should survive delete --all")
131-
#expect(try f.run(["inspect", stoppedName]).status != 0, "stopped container should be deleted")
132-
}
133-
}
134-
135-
@Test func testDeleteAllForce() async throws {
136-
try await ContainerFixture.with { f in
137-
let image = try f.copyWarmupImage(ContainerFixture.warmupImages[0])
138-
let name = "\(f.testID)-c"
139-
try f.doLongRun(name: name, image: image, autoRemove: false)
140-
f.addCleanup { try f.doRemoveIfExists(name, force: true, ignoreFailure: true) }
141-
142-
try f.run(["delete", "--all", "--force"]).check()
143-
144-
#expect(try f.run(["inspect", name]).status != 0, "container should be deleted by --force")
145-
}
146-
}
147-
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//===----------------------------------------------------------------------===//
2+
// Copyright © 2026 Apple Inc. and the container project authors.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//===----------------------------------------------------------------------===//
16+
17+
import Foundation
18+
import Testing
19+
20+
/// Serial removal tests that use `delete --all` and affect global container state.
21+
@Suite(.serialized)
22+
struct TestCLIRemoveSerial {
23+
@Test func testDeleteAllStopped() async throws {
24+
try await ContainerFixture.with { f in
25+
let image = try f.copyWarmupImage(ContainerFixture.warmupImages[0])
26+
let name1 = "\(f.testID)-c1"
27+
let name2 = "\(f.testID)-c2"
28+
try f.doCreate(name: name1, image: image)
29+
f.addCleanup { try f.doRemoveIfExists(name1, ignoreFailure: true) }
30+
try f.doCreate(name: name2, image: image)
31+
f.addCleanup { try f.doRemoveIfExists(name2, ignoreFailure: true) }
32+
33+
try f.run(["delete", "--all"]).check()
34+
35+
#expect(try f.run(["inspect", name1]).status != 0, "name1 should be deleted")
36+
#expect(try f.run(["inspect", name2]).status != 0, "name2 should be deleted")
37+
}
38+
}
39+
40+
@Test func testDeleteAllSkipsRunning() async throws {
41+
try await ContainerFixture.with { f in
42+
let image = try f.copyWarmupImage(ContainerFixture.warmupImages[0])
43+
let runningName = "\(f.testID)-running"
44+
let stoppedName = "\(f.testID)-stopped"
45+
46+
try f.doLongRun(name: runningName, image: image, autoRemove: false)
47+
f.addCleanup {
48+
try? f.doStop(runningName)
49+
try? f.doRemove(runningName)
50+
}
51+
try f.doCreate(name: stoppedName, image: image)
52+
f.addCleanup { try f.doRemoveIfExists(stoppedName, ignoreFailure: true) }
53+
54+
try f.run(["delete", "--all"]).check()
55+
56+
#expect(try f.getContainerStatus(runningName) == "running", "running container should survive delete --all")
57+
#expect(try f.run(["inspect", stoppedName]).status != 0, "stopped container should be deleted")
58+
}
59+
}
60+
61+
@Test func testDeleteAllForce() async throws {
62+
try await ContainerFixture.with { f in
63+
let image = try f.copyWarmupImage(ContainerFixture.warmupImages[0])
64+
let name = "\(f.testID)-c"
65+
try f.doLongRun(name: name, image: image, autoRemove: false)
66+
f.addCleanup { try f.doRemoveIfExists(name, force: true, ignoreFailure: true) }
67+
68+
try f.run(["delete", "--all", "--force"]).check()
69+
70+
#expect(try f.run(["inspect", name]).status != 0, "container should be deleted by --force")
71+
}
72+
}
73+
}

Tests/IntegrationTests/Containers/TestCLIStats.swift renamed to Tests/IntegrationTests/Containers/TestCLIStatsCommand.swift

File renamed without changes.

0 commit comments

Comments
 (0)