Skip to content
Open
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
9 changes: 6 additions & 3 deletions Sources/ContainerTestSupport/BuildFixture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import ContainerizationExtras
import Darwin
import Foundation
import SystemPackage
import Testing

// MARK: - Build context types

Expand Down Expand Up @@ -309,12 +308,16 @@ extension ContainerFixture {
/// Asserts that `path` exists as a regular file inside `container`.
public func assertContainerHasFile(_ container: String, at path: String, _ comment: String? = nil) throws {
let exists = try containerHasFile(container, at: path)
#expect(exists, "\(comment ?? path) should exist in container")
guard exists else {
throw CommandError.executionFailed("\(comment ?? path) should exist in container")
}
}

/// Asserts that `path` does NOT exist inside `container`.
public func assertContainerMissingFile(_ container: String, at path: String, _ comment: String? = nil) throws {
let exists = try containerHasFile(container, at: path)
#expect(!exists, "\(comment ?? path) should NOT exist in container")
guard !exists else {
throw CommandError.executionFailed("\(comment ?? path) should NOT exist in container")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import Foundation
import SystemPackage
import Testing

// MARK: - Image inspect types

Expand Down Expand Up @@ -109,6 +108,8 @@ extension ContainerFixture {
/// Asserts that the image was successfully built and is present in the image store.
public func assertImageBuilt(_ image: String) throws {
let name = try inspectImage(image)
#expect(name == image, "expected image \(image) to be present")
guard name == image else {
throw CommandError.executionFailed("expected image \(image) to be present")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//===----------------------------------------------------------------------===//

import Foundation
import Testing

// MARK: - Machine output types

Expand Down
1 change: 0 additions & 1 deletion Sources/ContainerTestSupport/ContainerFixture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Foundation
import Logging
import Synchronization
import SystemPackage
import Testing

/// Per-test fixture for CLI integration tests.
///
Expand Down
Loading