Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Integration test additions for Glacier & Route53 #1615

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions IntegrationTests/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func addIntegrationTestTarget(_ name: String) {
"README.md",
"Resources/ECSIntegTestApp/"
]
case "AWSGlacier":
additionalDependencies = ["AWSSTS"]
case "AWSS3":
additionalDependencies = ["AWSSSOAdmin", "AWSS3Control", "AWSSTS"]
case "AWSEventBridge":
Expand Down Expand Up @@ -135,6 +137,7 @@ let servicesWithIntegrationTests: [String] = [
"AWSEC2",
"AWSECS",
"AWSEventBridge",
"AWSGlacier",
"AWSKinesis",
"AWSMediaConvert",
"AWSRoute53",
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
}
2 changes: 1 addition & 1 deletion scripts/integration-test-sdk.properties
Original file line number Diff line number Diff line change
@@ -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
Loading