mirror of
https://github.com/apple/container.git
synced 2026-09-21 07:05:57 +00:00
Remove @unchecked Sendable (#250)
This PR removes `@unchecked Sendable` from the tests.
This commit is contained in:
@@ -20,8 +20,7 @@ import ContainerizationOS
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
// This test class is not thread safe
|
||||
class TestCLIRunBase: CLITest, @unchecked Sendable {
|
||||
class TestCLIRunBase: CLITest {
|
||||
var terminal: Terminal!
|
||||
var containerName: String = UUID().uuidString
|
||||
|
||||
@@ -62,7 +61,12 @@ class TestCLIRunBase: CLITest, @unchecked Sendable {
|
||||
func containerRun(stdin: [String], findMessage: String) async throws -> Bool {
|
||||
let stdout = FileHandle(fileDescriptor: terminal.handle.fileDescriptor, closeOnDealloc: false)
|
||||
let stdoutListenTask = Task {
|
||||
try await findStdoutOutput(stdout: stdout, findMessage: findMessage)
|
||||
for try await line in stdout.bytes.lines {
|
||||
if line.contains(findMessage) && !line.contains("echo") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
let timeoutTask = Task {
|
||||
@@ -82,15 +86,6 @@ class TestCLIRunBase: CLITest, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
func findStdoutOutput(stdout: FileHandle, findMessage: String) async throws -> Bool {
|
||||
for try await line in stdout.bytes.lines {
|
||||
if line.contains(findMessage) && !line.contains("echo") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func exec(commands: [String]) throws {
|
||||
let stdin = FileHandle(fileDescriptor: terminal.handle.fileDescriptor, closeOnDealloc: false)
|
||||
try commands.forEach { cmd in
|
||||
|
||||
@@ -21,8 +21,7 @@ import Foundation
|
||||
import Testing
|
||||
|
||||
extension TestCLIRunBase {
|
||||
// This test class is NOT thread safe
|
||||
class TestCLITermIO: TestCLIRunBase, @unchecked Sendable {
|
||||
class TestCLITermIO: TestCLIRunBase {
|
||||
override var ContainerImage: String {
|
||||
"ghcr.io/linuxcontainers/alpine:3.20"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user