Skip to content

Commit 3f36c3d

Browse files
committed
Integration: Log container bootlog in run test failures
If any of the container run tests fail on the basic setup phases (e.g. actually starting the container) we should log the bootlog to see if we can glean any info off of this.
1 parent b50dc25 commit 3f36c3d

File tree

6 files changed

+129
-197
lines changed

6 files changed

+129
-197
lines changed

Tests/CLITests/Subcommands/Build/CLIBuilderTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ extension TestCLIBuildBase {
333333
try self.build(tag: imageName, tempDir: tempDir)
334334
#expect(try self.inspectImage(imageName) == imageName, "expected to have successfully built \(imageName)")
335335
// Check if the image we built is actually in the image store, and can be used.
336-
try self.doLongRun(name: containerName, image: imageName)
336+
try self.doLongRun(name: containerName, image: imageName, autoRemove: true)
337337
defer {
338338
try? self.doStop(name: containerName)
339339
}

Tests/CLITests/Subcommands/Networks/TestCLINetwork.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class TestCLINetwork: CLITest {
4848
name: name,
4949
image: "docker.io/library/python:alpine",
5050
args: ["--network", name],
51-
containerArgs: ["python3", "-m", "http.server", "--bind", "0.0.0.0", "\(port)"])
51+
containerArgs: ["python3", "-m", "http.server", "--bind", "0.0.0.0", "\(port)"],
52+
autoRemove: true,
53+
)
5254
defer {
5355
try? doStop(name: name)
5456
}

Tests/CLITests/Subcommands/Run/TestCLIRunLifecycle.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class TestCLIRunLifecycle: CLITest {
2727
name,
2828
]
2929
#expect(throws: CLIError.self, "expect container to fail with invalid user") {
30-
try self.doLongRun(name: name, args: badArgs)
30+
try self.doLongRun(name: name, args: badArgs, autoRemove: true)
3131
}
3232

3333
// try to create a container with the same name but no user that should succeed
3434
#expect(throws: Never.self, "expected container run to succeed") {
35-
try self.doLongRun(name: name, args: [])
35+
try self.doLongRun(name: name, args: [], autoRemove: true)
3636
defer {
3737
try? self.doStop(name: name)
3838
}

0 commit comments

Comments
 (0)