Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ endef
# PARALLEL_WIDTH controls --experimental-maximum-parallelization-width for the
# concurrent pass. WARMUP_FILTER, CONCURRENT_FILTER, and GLOBAL_FILTER select
# the three phases. Expand the filter lists as suites are migrated from CLITests.
#PARALLEL_WIDTH ?= $(shell sysctl -n hw.physicalcpu)
PARALLEL_WIDTH ?= 2
WARMUP_FILTER = ImageWarmup/

Expand Down
2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ let package = Package(
.product(name: "ContainerizationArchive", package: "containerization"),
.product(name: "ContainerizationExtras", package: "containerization"),
.product(name: "ContainerizationOCI", package: "containerization"),
.product(name: "ContainerizationOS", package: "containerization"),
.product(name: "TOML", package: "swift-toml"),
"ContainerAPIClient",
"ContainerLog",
"ContainerPersistence",
Expand Down
70 changes: 70 additions & 0 deletions Tests/CLITests/Subcommands/Images/TestCLIProgressAuto.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//===----------------------------------------------------------------------===//
// Copyright © 2026 Apple Inc. and the container project authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//

import Foundation
import Testing

class TestCLIProgressAuto: CLITest {
@Test func testAutoProgressFallsBackToPlainWhenPiped() throws {
let (_, _, error, status) = try run(arguments: [
"image", "pull",
"--progress", "auto",
alpine,
])
#expect(status == 0, "image pull should succeed, stderr: \(error)")
let lines = error.components(separatedBy: .newlines)
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
#expect(!lines.isEmpty, "expected plain progress output on stderr when piped")
#expect(!error.contains("\u{1B}["), "expected no ANSI escapes in piped output")
}

@Test func testExplicitPlainProgress() throws {
let (_, _, error, status) = try run(arguments: [
"image", "pull",
"--progress", "plain",
alpine,
])
#expect(status == 0, "image pull --progress plain should succeed, stderr: \(error)")
let lines = error.components(separatedBy: .newlines)
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
#expect(!lines.isEmpty, "expected plain progress output on stderr")
#expect(!error.contains("\u{1B}["), "expected no ANSI escapes with --progress plain")
}

@Test func testExplicitAnsiProgress() throws {
let (_, _, error, status) = try run(arguments: [
"image", "pull",
"--progress", "ansi",
alpine,
])
#expect(status == 0, "image pull --progress ansi should succeed, stderr: \(error)")
let lines = error.components(separatedBy: .newlines)
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
#expect(!lines.isEmpty, "expected ansi progress output on stderr")
}

@Test func testNoneProgressSuppressesOutput() throws {
let (_, _, error, status) = try run(arguments: [
"image", "pull",
"--progress", "none",
alpine,
])
#expect(status == 0, "image pull --progress none should succeed, stderr: \(error)")
let lines = error.components(separatedBy: .newlines)
.filter { !$0.contains("Warning! Running debug build") && !$0.isEmpty }
#expect(lines.isEmpty, "expected no progress output on stderr with --progress none")
}
}
Loading