diff --git a/IntegrationTests/Package.swift b/IntegrationTests/Package.swift index cbba8617871..196b3aefe1a 100644 --- a/IntegrationTests/Package.swift +++ b/IntegrationTests/Package.swift @@ -97,6 +97,8 @@ func addIntegrationTestTarget(_ name: String) { "README.md", "Resources/ECSIntegTestApp/" ] + case "AWSGlacier": + additionalDependencies = ["AWSSTS"] case "AWSS3": additionalDependencies = ["AWSSSOAdmin", "AWSS3Control", "AWSSTS"] case "AWSEventBridge": @@ -135,6 +137,7 @@ let servicesWithIntegrationTests: [String] = [ "AWSEC2", "AWSECS", "AWSEventBridge", + "AWSGlacier", "AWSKinesis", "AWSMediaConvert", "AWSRoute53", diff --git a/IntegrationTests/Services/AWSGlacierIntegrationTests/GlacierTests.swift b/IntegrationTests/Services/AWSGlacierIntegrationTests/GlacierTests.swift new file mode 100644 index 00000000000..a15aaa8b0b8 --- /dev/null +++ b/IntegrationTests/Services/AWSGlacierIntegrationTests/GlacierTests.swift @@ -0,0 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation +import XCTest +import AWSGlacier +import AWSSTS +import enum Smithy.ByteStream +import SmithyWaitersAPI + +/// Tests that Glacier operations run successfully +class GlacierTests: XCTestCase { + var glacierClient: GlacierClient! + var stsClient: STSClient! + var accountId: String! + var archiveId: String! + let vaultName = UUID().uuidString.split(separator: "-").first!.lowercased() + "integ-test-vault" + + override func setUp() async throws { + stsClient = try STSClient(region: "us-east-1") + accountId = try await stsClient.getCallerIdentity(input: GetCallerIdentityInput()).account + glacierClient = try GlacierClient(region: "us-east-1") + } + + override func tearDown() async throws { + let deleteVaultInput = DeleteVaultInput(accountId: nil, vaultName: vaultName) + _ = try await glacierClient.deleteVault(input: deleteVaultInput) + } + + func testCreateVault() async throws { + // Intentionally set accountId to nil for testing customization that sets it to '-' if nil + let createVaultInput = CreateVaultInput(accountId: nil, vaultName: vaultName) + let vaultURI = try await glacierClient.createVault(input: createVaultInput).location + let expectedURI = "/\(accountId!)/vaults/\(vaultName)" + XCTAssertEqual(expectedURI, vaultURI) + } +} + diff --git a/IntegrationTests/Services/AWSGlacierIntegrationTests/Resources/.gitkeep b/IntegrationTests/Services/AWSGlacierIntegrationTests/Resources/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift b/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift index 0fad3cfd45f..6e5f70ea024 100644 --- a/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift +++ b/IntegrationTests/Services/AWSRoute53IntegrationTests/AWSRoute53Tests.swift @@ -62,11 +62,39 @@ class AWSRoute53Tests: XCTestCase { ] ) let input1 = ChangeResourceRecordSetsInput(changeBatch: createBatch, hostedZoneId: hostedZoneID) - let output1 = try await client.changeResourceRecordSets(input: input1) + _ = try await client.changeResourceRecordSets(input: input1) + + // Send a malformed request that deletes the A record that was just created more than once + // to test for InvalidBatchError handling. + let deleteBatch1 = Route53ClientTypes.ChangeBatch(changes: + [ + Route53ClientTypes.Change( + action: .delete, + resourceRecordSet: Route53ClientTypes.ResourceRecordSet( + name: "abc.\(hostedZoneName)", resourceRecords: [Route53ClientTypes.ResourceRecord(value: "1.1.1.1")], ttl: 3600, type: .a + ) + ), + Route53ClientTypes.Change( + action: .delete, + resourceRecordSet: Route53ClientTypes.ResourceRecordSet( + name: "abc.\(hostedZoneName)", resourceRecords: [Route53ClientTypes.ResourceRecord(value: "1.1.1.1")], ttl: 3600, type: .a + ) + ), + ] + ) + let input2 = ChangeResourceRecordSetsInput(changeBatch: deleteBatch1, hostedZoneId: hostedZoneID) + do { + _ = try await client.changeResourceRecordSets(input: input2) + XCTFail("Expected InvalidChangeBatch error, but no error thrown.") + } catch is InvalidChangeBatch { + // no-op + } catch { + XCTFail("Expected InvalidChangeBatch error, but [\(error.localizedDescription)] was thrown instead.") + } // Now delete the A record that was just created; this is necessary for the // hosted zone to be deleted in test teardown. - let deleteBatch = Route53ClientTypes.ChangeBatch(changes: + let deleteBatch2 = Route53ClientTypes.ChangeBatch(changes: [ Route53ClientTypes.Change( action: .delete, @@ -76,7 +104,7 @@ class AWSRoute53Tests: XCTestCase { ), ] ) - let input2 = ChangeResourceRecordSetsInput(changeBatch: deleteBatch, hostedZoneId: hostedZoneID) - let output2 = try await client.changeResourceRecordSets(input: input2) + let input3 = ChangeResourceRecordSetsInput(changeBatch: deleteBatch2, hostedZoneId: hostedZoneID) + _ = try await client.changeResourceRecordSets(input: input3) } } diff --git a/scripts/integration-test-sdk.properties b/scripts/integration-test-sdk.properties index b1a6f1ba173..2a889701dbe 100644 --- a/scripts/integration-test-sdk.properties +++ b/scripts/integration-test-sdk.properties @@ -1,2 +1,2 @@ # Only include services needed for running integration tests -onlyIncludeModels=kinesis.2013-12-02,s3.2006-03-01,sso-admin.2020-07-20,transcribe-streaming.2017-10-26,sqs.2012-11-05,mediaconvert.2017-08-29,sts.2011-06-15,cognito-identity.2014-06-30,iam.2010-05-08,ec2.2016-11-15,ecs.2014-11-13,cloudwatch-logs.2014-03-28,s3-control.2018-08-20,eventbridge.2015-10-07,cloudfront.2020-05-31,cloudfront-keyvaluestore.2022-07-26,route-53.2013-04-01 +onlyIncludeModels=kinesis.2013-12-02,s3.2006-03-01,sso-admin.2020-07-20,transcribe-streaming.2017-10-26,sqs.2012-11-05,mediaconvert.2017-08-29,sts.2011-06-15,cognito-identity.2014-06-30,iam.2010-05-08,ec2.2016-11-15,ecs.2014-11-13,cloudwatch-logs.2014-03-28,s3-control.2018-08-20,eventbridge.2015-10-07,cloudfront.2020-05-31,cloudfront-keyvaluestore.2022-07-26,route-53.2013-04-01,glacier.2012-06-01