mirror of
https://github.com/apple/container.git
synced 2026-07-11 20:17:08 +00:00
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:
@@ -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 ; \
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user