Use a consistent container CLI path in integration tests (#1621)

Use a consistent container CLI path in integration tests. See https://github.com/apple/container/issues/1602.
This commit is contained in:
Di Warachet S.
2026-06-02 11:38:10 +07:00
committed by GitHub
parent 55f1e4fdf4
commit 34cff5925f
2 changed files with 7 additions and 31 deletions
+2
View File
@@ -255,6 +255,7 @@ coverage-integration: all
echo "Starting CLI integration tests with coverage" && \
{ \
export CLITEST_LOG_ROOT=$(LOG_ROOT) ; \
export CONTAINER_CLI_PATH=$(ROOT_DIR)/bin/container ; \
$(SWIFT) test --skip-build --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(INTEGRATION_FILTER)" ; \
exit_code=$$? ; \
cp $(COV_DATA_DIR)/*.profraw $(COVERAGE_OUTPUT_DIR)/integration/ ; \
@@ -280,6 +281,7 @@ integration: init-block
echo "Starting CLI integration tests" && \
{ \
CLITEST_LOG_ROOT=$(LOG_ROOT) && export CLITEST_LOG_ROOT ; \
CONTAINER_CLI_PATH=$(ROOT_DIR)/bin/container && export CONTAINER_CLI_PATH ; \
$(SWIFT) test -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(INTEGRATION_FILTER)" ; \
exit_code=$$? ; \
echo Ensuring apiserver stopped after the CLI integration tests ; \
+5 -31
View File
@@ -106,39 +106,14 @@ class CLITest {
let fileManager = FileManager.default
let currentDir = fileManager.currentDirectoryPath
let releaseURL = URL(fileURLWithPath: currentDir)
.appendingPathComponent(".build")
.appendingPathComponent("release")
let binURL = URL(fileURLWithPath: currentDir)
.appendingPathComponent("bin")
.appendingPathComponent("container")
let debugURL = URL(fileURLWithPath: currentDir)
.appendingPathComponent(".build")
.appendingPathComponent("debug")
.appendingPathComponent("container")
let releaseExists = fileManager.fileExists(atPath: releaseURL.path)
let debugExists = fileManager.fileExists(atPath: debugURL.path)
if releaseExists && debugExists { // choose the latest build
do {
let releaseAttributes = try fileManager.attributesOfItem(atPath: releaseURL.path)
let debugAttributes = try fileManager.attributesOfItem(atPath: debugURL.path)
if let releaseDate = releaseAttributes[.modificationDate] as? Date,
let debugDate = debugAttributes[.modificationDate] as? Date
{
return (releaseDate > debugDate) ? releaseURL : debugURL
}
} catch {
throw CLIError.binaryAttributesNotFound(error)
}
} else if releaseExists {
return releaseURL
} else if debugExists {
return debugURL
guard fileManager.fileExists(atPath: binURL.path) else {
throw CLIError.binaryNotFound
}
// both do not exist
throw CLIError.binaryNotFound
return binURL
}
}
@@ -272,7 +247,6 @@ class CLITest {
case containerNotFound(String)
case containerRunFailed(String)
case binaryNotFound
case binaryAttributesNotFound(Error)
}
func doLongRun(