-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make AWS SDK CLI test runner fail when tests fail (#1049)
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Utils/ProcessUtilsTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
@testable import AWSSDKSwiftCLI | ||
import PackageDescription | ||
import ArgumentParser | ||
import XCTest | ||
|
||
class ProcessUtilsTests: XCTestCase { | ||
|
||
func test_exit_itThrowsErrorWithErrorCode() { | ||
let process = Process("false") // this refers to /usr/bin/false which always returns unsuccessfully | ||
do { | ||
try ProcessRunner.standard.run(process) | ||
XCTFail("Process runner should have thrown") | ||
} catch let exitCodeError as ExitCode { | ||
XCTAssertTrue(exitCodeError.rawValue != 0) | ||
} catch { | ||
XCTFail("Process runner threw an unexpected type of error") | ||
} | ||
} | ||
} |