Skip to content

Commit 69a2505

Browse files
authored
Migrates container run integration tests. (#1857)
- Part of #1833.
1 parent 9bd3c47 commit 69a2505

19 files changed

Lines changed: 2069 additions & 1695 deletions

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ endef
198198
# PARALLEL_WIDTH controls --experimental-maximum-parallelization-width for the
199199
# concurrent pass. WARMUP_FILTER, CONCURRENT_FILTER, and GLOBAL_FILTER select
200200
# the three phases. Expand the filter lists as suites are migrated from CLITests.
201+
#PARALLEL_WIDTH ?= $(shell sysctl -n hw.physicalcpu)
201202
PARALLEL_WIDTH ?= 2
202203
WARMUP_FILTER = ImageWarmup/
203204

Package.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ let package = Package(
9090
.product(name: "ContainerizationArchive", package: "containerization"),
9191
.product(name: "ContainerizationExtras", package: "containerization"),
9292
.product(name: "ContainerizationOCI", package: "containerization"),
93+
.product(name: "ContainerizationOS", package: "containerization"),
94+
.product(name: "TOML", package: "swift-toml"),
9395
"ContainerAPIClient",
9496
"ContainerLog",
9597
"ContainerPersistence",
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
class TestCLIProgressAuto: CLITest {
21+
@Test func testAutoProgressFallsBackToPlainWhenPiped() throws {
22+
let (_, _, error, status) = try run(arguments: [
23+
"image", "pull",
24+
"--progress", "auto",
25+
alpine,
26+
])
27+
#expect(status == 0, "image pull should succeed, stderr: \(error)")
28+
let lines = error.components(separatedBy: .newlines)
29+
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
30+
#expect(!lines.isEmpty, "expected plain progress output on stderr when piped")
31+
#expect(!error.contains("\u{1B}["), "expected no ANSI escapes in piped output")
32+
}
33+
34+
@Test func testExplicitPlainProgress() throws {
35+
let (_, _, error, status) = try run(arguments: [
36+
"image", "pull",
37+
"--progress", "plain",
38+
alpine,
39+
])
40+
#expect(status == 0, "image pull --progress plain should succeed, stderr: \(error)")
41+
let lines = error.components(separatedBy: .newlines)
42+
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
43+
#expect(!lines.isEmpty, "expected plain progress output on stderr")
44+
#expect(!error.contains("\u{1B}["), "expected no ANSI escapes with --progress plain")
45+
}
46+
47+
@Test func testExplicitAnsiProgress() throws {
48+
let (_, _, error, status) = try run(arguments: [
49+
"image", "pull",
50+
"--progress", "ansi",
51+
alpine,
52+
])
53+
#expect(status == 0, "image pull --progress ansi should succeed, stderr: \(error)")
54+
let lines = error.components(separatedBy: .newlines)
55+
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
56+
#expect(!lines.isEmpty, "expected ansi progress output on stderr")
57+
}
58+
59+
@Test func testNoneProgressSuppressesOutput() throws {
60+
let (_, _, error, status) = try run(arguments: [
61+
"image", "pull",
62+
"--progress", "none",
63+
alpine,
64+
])
65+
#expect(status == 0, "image pull --progress none should succeed, stderr: \(error)")
66+
let lines = error.components(separatedBy: .newlines)
67+
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
68+
#expect(lines.isEmpty, "expected no progress output on stderr with --progress none")
69+
}
70+
}

0 commit comments

Comments
 (0)