diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01c43b68f..432d7f38b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: with: fetch-depth: 1 - name: SPM tests - run: swift test --enable-code-coverage + run: swift test --enable-code-coverage --sanitize=thread - name: Convert coverage files run: | xcrun llvm-cov export -format "lcov" \ @@ -46,7 +46,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - tag: ['swift:5.1', 'swift:5.2'] + tag: + - swift:5.1 + - swift:5.2 container: image: ${{ matrix.tag }} steps: @@ -57,9 +59,9 @@ jobs: - name: Install dependencies run: | apt-get update -qq - apt-get install -q -y tzdata libssl-dev zlib1g-dev + apt-get install -q -y tzdata libssl-dev zlib1g-dev curl - name: Test - run: swift test --parallel --enable-code-coverage --enable-test-discovery + run: swift test --enable-test-discovery --enable-code-coverage --sanitize=thread - name: Convert coverage files run: | llvm-cov export -format="lcov" \ @@ -67,6 +69,6 @@ jobs: -ignore-filename-regex="\/Tests\/" \ -instr-profile .build/debug/codecov/default.profdata > info.lcov - name: Upload to codecov.io - uses: codecov/codecov-action@v1.0.3 + uses: codecov/codecov-action@v1 with: - token: ${{secrets.CODECOV_TOKEN}} + file: info.lcov diff --git a/Tests/AWSCryptoTests/AWSCryptoTests.swift b/Tests/AWSCryptoTests/AWSCryptoTests.swift index 5b743f0ed..10b644c04 100644 --- a/Tests/AWSCryptoTests/AWSCryptoTests.swift +++ b/Tests/AWSCryptoTests/AWSCryptoTests.swift @@ -142,19 +142,6 @@ final class AWSCryptoTests: XCTestCase { XCTAssertEqual(authenticationKey, authenticationKey2) XCTAssertEqual(authenticationKey.hexDigest(), authenticationKey2.hexDigest()) } - - static var allTests = [ - ("testMD5", testMD5), - ("testSHA256", testSHA256), - ("testSHA384", testSHA384), - ("testSHA512", testSHA512), - ("testHMAC", testHMAC), - ("testMD5InitUpdateFinal", testMD5InitUpdateFinal), - ("testSHA256InitUpdateFinal", testSHA256InitUpdateFinal), - ("testSHA384InitUpdateFinal", testSHA384InitUpdateFinal), - ("testSHA512InitUpdateFinal", testSHA512InitUpdateFinal), - ("testHMACInitUpdateFinal", testHMACInitUpdateFinal) - ] } public extension Sequence where Element == UInt8 { diff --git a/Tests/AWSSDKSwiftCoreTests/AWSClientTests.swift b/Tests/AWSSDKSwiftCoreTests/AWSClientTests.swift index d24c3dba1..3a41b1c7d 100644 --- a/Tests/AWSSDKSwiftCoreTests/AWSClientTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/AWSClientTests.swift @@ -41,43 +41,6 @@ class AWSClientTests: XCTestCase { } } - static var allTests : [(String, (AWSClientTests) -> () throws -> Void)] { - return [ - ("testGetCredential", testGetCredential), - ("testExpiredCredential", testExpiredCredential), - ("testCreateAWSRequest", testCreateAWSRequest), - ("testCreateNIORequest", testCreateNIORequest), - ("testUnsignedClient", testUnsignedClient), - ("testProtocolContentType", testProtocolContentType), - ("testHeaderEncoding", testHeaderEncoding), - ("testQueryEncoding", testQueryEncoding), - ("testQueryEncodedArray", testQueryEncodedArray), - ("testQueryEncodedDictionary", testQueryEncodedDictionary), - ("testURIEncoding", testURIEncoding), - ("testValidateXMLResponse", testValidateXMLResponse), - ("testValidateXMLCodablePayloadResponse", testValidateXMLCodablePayloadResponse), - ("testXMLError", testXMLError), - ("testValidateQueryError", testQueryError), - ("testValidateJSONResponse", testValidateJSONResponse), - ("testValidateJSONCodablePayloadResponse", testValidateJSONCodablePayloadResponse), - ("testValidateJSONRawPayloadResponse", testValidateJSONRawPayloadResponse), - ("testValidateJSONError", testJSONError), - ("testProcessHAL", testProcessHAL), - ("testDataInJsonPayload", testDataInJsonPayload), - ("testPayloadDataInResponse", testPayloadDataInResponse), - ("testClientNoInputNoOutput", testClientNoInputNoOutput), - ("testClientWithInputNoOutput", testClientWithInputNoOutput), - ("testClientNoInputWithOutput", testClientNoInputWithOutput), - ("testEC2ClientRequest", testEC2ClientRequest), - ("testEC2ValidateError", testEC2ValidateError), - ("testRegionEnum", testRegionEnum), - ("testServerError", testServerError), - ("testClientRetry", testClientRetry), - ("testClientRetryFail", testClientRetryFail), - ("testClientResponseEventLoop", testClientResponseEventLoop), - ] - } - struct C: AWSEncodableShape { public static var _encoding: [AWSMemberEncoding] = [ AWSMemberEncoding(label: "value", location: .header(locationName: "value")) diff --git a/Tests/AWSSDKSwiftCoreTests/CredentialTests.swift b/Tests/AWSSDKSwiftCoreTests/CredentialTests.swift index b29264f82..6250fec01 100644 --- a/Tests/AWSSDKSwiftCoreTests/CredentialTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/CredentialTests.swift @@ -240,17 +240,4 @@ class CredentialTests: XCTestCase { XCTFail("\(error)") } } - - static var allTests : [(String, (CredentialTests) -> () throws -> Void)] { - return [ - ("testSharedCredentials", testSharedCredentials), - ("testSharedCredentialsMissingSessionToken", testSharedCredentialsMissingSessionToken), - ("testSharedCredentialsMissingAccessKey", testSharedCredentialsMissingAccessKey), - ("testSharedCredentialsMissingSecretKey", testSharedCredentialsMissingSecretKey), - ("testSharedCredentialsMissingProfile", testSharedCredentialsMissingProfile), - ("testSharedCredentialsParseFailure", testSharedCredentialsParseFailure), - ("testExpiringCredential", testExpiringCredential), - ("testSharedCredentialINIParser", testSharedCredentialINIParser) - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/DictionaryEncoderTests.swift b/Tests/AWSSDKSwiftCoreTests/DictionaryEncoderTests.swift index 1fc6ae1f9..4d0fd27c4 100644 --- a/Tests/AWSSDKSwiftCoreTests/DictionaryEncoderTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/DictionaryEncoderTests.swift @@ -405,26 +405,5 @@ class DictionaryEncoderTests: XCTestCase { XCTFail("\(error)") } } - - static var allTests : [(String, (DictionaryEncoderTests) -> () throws -> Void)] { - return [ - ("testDecode", testDecode), - ("testDecodeFail", testDecodeFail), - ("testSimpleStructureDecodeEncode", testSimpleStructureDecodeEncode), - ("testBaseTypesDecodeEncode", testBaseTypesDecodeEncode), - ("testContainingStructureDecodeEncode", testContainingStructureDecodeEncode), - ("testEnumDecodeEncode", testEnumDecodeEncode), - ("testArrayDecodeEncode", testArrayDecodeEncode), - ("testArrayOfStructuresDecodeEncode", testArrayOfStructuresDecodeEncode), - ("testDictionaryDecodeEncode", testDictionaryDecodeEncode), - ("testEnumDictionaryDecodeEncode", testEnumDictionaryDecodeEncode), - ("testDataDecodeEncode", testDataDecodeEncode), - ("testFloatOverflowDecodeErrors", testFloatOverflowDecodeErrors), - ("testInvalidValueDecodeErrors", testInvalidValueDecodeErrors), - ("testMissingKeyDecodeErrors", testMissingKeyDecodeErrors), - ("testNestedContainer", testNestedContainer), - ("testSupercoder", testSupercoder) - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/HTTPClientTests.swift b/Tests/AWSSDKSwiftCoreTests/HTTPClientTests.swift index 796d1794a..9a62af088 100644 --- a/Tests/AWSSDKSwiftCoreTests/HTTPClientTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/HTTPClientTests.swift @@ -127,14 +127,6 @@ class AsyncHTTPClientTests: XCTestCase { func testBody() { HTTPClientTests(client).testBody() } - - static var allTests : [(String, (AsyncHTTPClientTests) -> () throws -> Void)] { - return [ - ("testGet", testGet), - ("testHeaders", testHeaders), - ("testBody", testBody) - ] - } } /// HTTP Client tests, to be used with any HTTP client that conforms to AWSHTTPClient diff --git a/Tests/AWSSDKSwiftCoreTests/JSONCoderTests.swift b/Tests/AWSSDKSwiftCoreTests/JSONCoderTests.swift index 914c68aae..aa22c96b6 100644 --- a/Tests/AWSSDKSwiftCoreTests/JSONCoderTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/JSONCoderTests.swift @@ -151,12 +151,6 @@ class JSONCoderTests: XCTestCase { XCTFail(error.localizedDescription) } } - - static var allTests : [(String, (JSONCoderTests) -> () throws -> Void)] { - return [ - ("testSerializeToDictionaryAndJSON", testSerializeToDictionaryAndJSON), - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/MetaDataServiceTests.swift b/Tests/AWSSDKSwiftCoreTests/MetaDataServiceTests.swift index 023189b66..7881809a8 100644 --- a/Tests/AWSSDKSwiftCoreTests/MetaDataServiceTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/MetaDataServiceTests.swift @@ -19,13 +19,6 @@ import NIOFoundationCompat @testable import AWSSDKSwiftCore class MetaDataServiceTests: XCTestCase { - static var allTests : [(String, (MetaDataServiceTests) -> () throws -> Void)] { - return [ - ("testInstanceMetaDataService", testInstanceMetaDataService), - ("testInstanceMetaDataServiceFail", testInstanceMetaDataServiceFail), - ("testMetaDataGetCredential", testMetaDataGetCredential) - ] - } func testInstanceMetaDataService() { let body: [String: String] = ["Code" : "Success", diff --git a/Tests/AWSSDKSwiftCoreTests/PaginateTests.swift b/Tests/AWSSDKSwiftCoreTests/PaginateTests.swift index aac9681d5..a0783d92d 100644 --- a/Tests/AWSSDKSwiftCoreTests/PaginateTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/PaginateTests.swift @@ -273,13 +273,4 @@ class PaginateTests: XCTestCase { print(error) } } - - static var allTests : [(String, (PaginateTests) -> () throws -> Void)] { - return [ - ("testIntegerTokenPaginate", testIntegerTokenPaginate), - ("testStringTokenPaginate", testStringTokenPaginate), - ("testPaginateError", testPaginateError), - ("testPaginateErrorAfterFirstRequest", testPaginateErrorAfterFirstRequest), - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/PayloadTests.swift b/Tests/AWSSDKSwiftCoreTests/PayloadTests.swift index 62d2703f3..8cff8d2d5 100644 --- a/Tests/AWSSDKSwiftCoreTests/PayloadTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/PayloadTests.swift @@ -107,12 +107,4 @@ class PayloadTests: XCTestCase { XCTFail("Unexpected error: \(error)") } } - - static var allTests : [(String, (PayloadTests) -> () throws -> Void)] { - return [ - ("testStringRequestPayload", testStringRequestPayload), - ("testDataRequestPayload", testDataRequestPayload), - ("testByteBufferRequestPayload", testByteBufferRequestPayload), - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/PerformanceTests.swift b/Tests/AWSSDKSwiftCoreTests/PerformanceTests.swift index 43303ceb4..b4b0e0643 100644 --- a/Tests/AWSSDKSwiftCoreTests/PerformanceTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/PerformanceTests.swift @@ -318,20 +318,4 @@ class PerformanceTests: XCTestCase { } } } - - static var allTests : [(String, (PerformanceTests) -> () throws -> Void)] { - return [ - ("testHeaderRequest", testHeaderRequest), - ("testXMLRequest", testXMLRequest), - ("testXMLPayloadRequest", testXMLPayloadRequest), - ("testJSONRequest", testJSONRequest), - ("testJSONPayloadRequest", testJSONPayloadRequest), - ("testQueryRequest", testQueryRequest), - ("testUnsignedRequest", testUnsignedRequest), - ("testSignedURLRequest", testSignedURLRequest), - ("testSignedHeadersRequest", testSignedHeadersRequest), - ("testValidateXMLResponse", testValidateXMLResponse), - ("testValidateJSONResponse", testValidateJSONResponse), - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/QueryEncoderTests.swift b/Tests/AWSSDKSwiftCoreTests/QueryEncoderTests.swift index ac98985e6..7dcc88cb7 100644 --- a/Tests/AWSSDKSwiftCoreTests/QueryEncoderTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/QueryEncoderTests.swift @@ -241,25 +241,6 @@ class QueryEncoderTests: XCTestCase { XCTAssertEqual(queryAsString, "Object.Data=Hello") } catch { XCTFail("\(error)") - } - - - } - - static var allTests : [(String, (QueryEncoderTests) -> () throws -> Void)] { - return [ - ("testSimpleStructureEncode", testSimpleStructureEncode), - ("testContainingStructureEncode", testContainingStructureEncode), - ("testEnumEncode", testEnumEncode), - ("testArrayEncode", testArrayEncode), - ("testArrayOfStructuresEncode", testArrayOfStructuresEncode), - ("testDictionaryEncode", testDictionaryEncode), - ("testDictionaryEnumKeyEncode", testDictionaryEnumKeyEncode), - ("testArrayEncodingEncode", testArrayEncodingEncode), - ("testDictionaryEncodingEncode", testDictionaryEncodingEncode), - ("testDictionaryEncodingEncode2", testDictionaryEncodingEncode2), - ("testDataBlobEncode", testDataBlobEncode), - ("testEC2Encode", testEC2Encode) - ] + } } } diff --git a/Tests/AWSSDKSwiftCoreTests/TimeStampTests.swift b/Tests/AWSSDKSwiftCoreTests/TimeStampTests.swift index 9f9a216a4..4f8fecc6a 100644 --- a/Tests/AWSSDKSwiftCoreTests/TimeStampTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/TimeStampTests.swift @@ -121,16 +121,4 @@ class TimeStampTests: XCTestCase { XCTFail("\(error)") } } - - static var allTests : [(String, (TimeStampTests) -> () throws -> Void)] { - return [ - ("testDecodeISOFromJSON", testDecodeISOFromJSON), - ("testDecodeISOFromXML", testDecodeISOFromXML), - ("testDecodeHttpFormattedTimestamp", testDecodeHttpFormattedTimestamp), - ("testDecodeUnixEpochTimestamp", testDecodeUnixEpochTimestamp), - ("testEncodeISO8601ToXML", testEncodeISO8601ToXML), - ("testEncodeHTTPHeaderToJSON", testEncodeHTTPHeaderToJSON), - ("testEncodeUnixEpochToJSON", testEncodeUnixEpochToJSON) - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/ValidationTests.swift b/Tests/AWSSDKSwiftCoreTests/ValidationTests.swift index 365b76c81..1f295307c 100644 --- a/Tests/AWSSDKSwiftCoreTests/ValidationTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/ValidationTests.swift @@ -139,15 +139,4 @@ class ValidationTests: XCTestCase { let a4 = A(path:"/%hello/test/") testValidationSuccess(a4) } - - static var allTests : [(String, (ValidationTests) -> () throws -> Void)] { - return [ - ("testNumericMinMaxValidation", testNumericMinMaxValidation), - ("testFloatingPointMinMaxValidation", testFloatingPointMinMaxValidation), - ("testStringLengthMinMaxValidation", testStringLengthMinMaxValidation), - ("testArrayLengthMinMaxValidation", testArrayLengthMinMaxValidation), - ("testStringPatternValidation", testStringPatternValidation), - ("testStringPattern2Validation", testStringPattern2Validation), - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/XMLCoderTests.swift b/Tests/AWSSDKSwiftCoreTests/XMLCoderTests.swift index 3b20588ca..d5430b8f4 100644 --- a/Tests/AWSSDKSwiftCoreTests/XMLCoderTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/XMLCoderTests.swift @@ -470,29 +470,4 @@ class XMLCoderTests: XCTestCase { XCTFail(error.localizedDescription) } } - - static var allTests : [(String, (XMLCoderTests) -> () throws -> Void)] { - return [ - ("testSimpleStructureDecodeEncode", testSimpleStructureDecodeEncode), - ("testContainingStructureDecodeEncode", testContainingStructureDecodeEncode), - ("testEnumDecodeEncode", testEnumDecodeEncode), - ("testArrayDecodeEncode", testArrayDecodeEncode), - ("testArrayOfStructuresDecodeEncode", testArrayOfStructuresDecodeEncode), - ("testDictionaryDecodeEncode", testDictionaryDecodeEncode), - ("testDataDecodeEncode", testDataDecodeEncode), - ("testSerializeToXML", testSerializeToXML), - ("testDecodeExpandedContainers", testDecodeExpandedContainers), - ("testArrayEncodingDecodeEncode", testArrayEncodingDecodeEncode), - ("testArrayOfStructuresEncodingDecodeEncode", testArrayOfStructuresEncodingDecodeEncode), - ("testDictionaryEncodingDecodeEncode", testDictionaryEncodingDecodeEncode), - ("testDictionaryOfStructuresEncodingDecodeEncode", testDictionaryOfStructuresEncodingDecodeEncode), - ("testFlatDictionaryEncodingDecodeEncode", testFlatDictionaryEncodingDecodeEncode), - ("testEnumDictionaryEncodingDecodeEncode", testEnumDictionaryEncodingDecodeEncode), - ("testEnumFlatDictionaryEncodingDecodeEncode", testEnumFlatDictionaryEncodingDecodeEncode), - - ("testEncodeDecodeXML", testEncodeDecodeXML), - ("testDecodeFail", testDecodeFail), - ("testEncodeDecodeDictionariesXML", testEncodeDecodeDictionariesXML) - ] - } } diff --git a/Tests/AWSSDKSwiftCoreTests/XMLTests.swift b/Tests/AWSSDKSwiftCoreTests/XMLTests.swift index dc2473ab4..51aba28ab 100644 --- a/Tests/AWSSDKSwiftCoreTests/XMLTests.swift +++ b/Tests/AWSSDKSwiftCoreTests/XMLTests.swift @@ -112,24 +112,5 @@ class XMLTests: XCTestCase { XCTFail(error.localizedDescription) } } - - static var allTests : [(String, (XMLTests) -> () throws -> Void)] { - return [ - ("testAddChild", testAddChild), - ("testAddRemoveChild", testAddRemoveChild), - ("testAttributeAdd", testAttributeAdd), - ("testAttributeReplace", testAttributeReplace), - ("testNamespaceAdd", testNamespaceAdd), - ("testNamespaceReplace", testNamespaceReplace), - ("testDocumentDefaultOutput", testDocumentDefaultOutput), - ("testNullNamespaceReplace", testNamespaceReplace), - ("testAttributesDecodeEncode", testAttributesDecodeEncode), - ("testNamespacesDecodeEncode", testNamespacesDecodeEncode), - ("testArrayDecodeEncode", testArrayDecodeEncode), - ("testCommentDecodeEncode", testArrayDecodeEncode), - ("testCDATADecodeEncode", testArrayDecodeEncode), - ("testWhitespaceDecodeEncode", testWhitespaceDecodeEncode), - ] - } } diff --git a/Tests/AWSSignerTests/AWSSignerTests.swift b/Tests/AWSSignerTests/AWSSignerTests.swift index 40d3d5204..1fc98918c 100644 --- a/Tests/AWSSignerTests/AWSSignerTests.swift +++ b/Tests/AWSSignerTests/AWSSignerTests.swift @@ -108,15 +108,4 @@ final class AWSSignerTests: XCTestCase { } } } - - static var allTests = [ - ("testSignGetHeaders", testSignGetHeaders), - ("testSignPutHeaders", testSignPutHeaders), - ("testSignS3GetURL", testSignS3GetURL), - ("testSignS3GetWithQueryURL", testSignS3GetWithQueryURL), - ("testSignS3PutURL", testSignS3PutURL), - ("testBodyData", testBodyData), - ("testPerformanceSignedURL", testPerformanceSignedURL), - ("testPerformanceSignedHeaders", testPerformanceSignedHeaders), - ] } diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index 15dc72669..32cfce2a8 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -11,24 +11,3 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// - -import XCTest -@testable import AWSSDKSwiftCoreTests -@testable import AWSSignerTests - -XCTMain([ - testCase(AsyncHTTPClientTests.allTests), - testCase(AWSClientTests.allTests), - testCase(CredentialTests.allTests), - testCase(DictionaryEncoderTests.allTests), - testCase(JSONCoderTests.allTests), - testCase(MetaDataServiceTests.allTests), - testCase(PaginateTests.allTests), - testCase(PerformanceTests.allTests), - testCase(QueryEncoderTests.allTests), - testCase(TimeStampTests.allTests), - testCase(ValidationTests.allTests), - testCase(XMLCoderTests.allTests), - testCase(XMLTests.allTests), - testCase(AWSSignerTests.allTests) -])