Remove @unchecked Sendable (#250)

This PR removes `@unchecked Sendable` from the tests.
This commit is contained in:
Dmitry Kovba
2025-06-24 10:45:21 -07:00
committed by GitHub
parent 90083956c2
commit aa71809da6
2 changed files with 8 additions and 14 deletions
@@ -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"
}