diff --git a/Makefile b/Makefile index e334b8f0..cebc907e 100644 --- a/Makefile +++ b/Makefile @@ -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 ; \ diff --git a/Tests/CLITests/Utilities/CLITest.swift b/Tests/CLITests/Utilities/CLITest.swift index a6247481..2e45579b 100644 --- a/Tests/CLITests/Utilities/CLITest.swift +++ b/Tests/CLITests/Utilities/CLITest.swift @@ -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(