Skip to content

Commit

Permalink
chore: Protocol tests set their own AWS credentials (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins committed Oct 28, 2024
1 parent 989cd0c commit 90ab3a8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 644 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ jobs:
set -o pipefail && \
NSUnbufferedIO=YES xcodebuild \
-scheme aws-sdk-swift-protocol-tests-Package \
-testPlan ProtocolTestPlan \
-destination '${{ matrix.destination }}' \
test 2>&1 \
| xcbeautify
Expand Down Expand Up @@ -183,18 +182,6 @@ jobs:
run: ./scripts/ci_steps/install_native_linux_dependencies.sh
- name: Tools Versions
run: ./scripts/ci_steps/log_tool_versions.sh
# Configure fake credentials using profiles
- name: (Credentials 1/3) Create AWS config directory
run: mkdir -p ~/.aws
- name: (Credentials 2/3) Create AWS config file
run: |
echo "[default]" > ~/.aws/config
echo "region=us-west-2" >> ~/.aws/config
- name: (Credentials 3/3) Create AWS credentials file
run: |
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id = test-key-id" >> ~/.aws/credentials
echo "aws_secret_access_key = test-secret-access-key" >> ~/.aws/credentials
- name: Prepare Protocol & Unit Tests
run: |
./scripts/ci_steps/prepare_protocol_and_unit_tests.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ClientRuntime
import Smithy
import SmithyTestUtil
import XCTest
import func SmithyTestUtil.dummyIdentityResolver


class DeleteObjectTaggingRequestTest: HttpRequestTestBase {
Expand All @@ -28,10 +29,13 @@ class DeleteObjectTaggingRequestTest: HttpRequestTestBase {
resolvedHost: "mybucket.s3.us-west-2.amazonaws.com"
)

let config = try await S3Client.S3ClientConfiguration()
config.region = "us-west-2"
config.httpClientEngine = ProtocolTestClient()
config.idempotencyTokenGenerator = ProtocolTestIdempotencyTokenGenerator()
let config = try await S3Client.Config(
awsCredentialIdentityResolver: try SmithyTestUtil.dummyIdentityResolver(),
region: "us-west-2",
signingRegion: "us-west-2",
idempotencyTokenGenerator: ProtocolTestIdempotencyTokenGenerator(),
httpClientEngine: ProtocolTestClient()
)
let client = S3Client(config: config)

let input = DeleteObjectTaggingInput(
Expand All @@ -57,10 +61,13 @@ class DeleteObjectTaggingRequestTest: HttpRequestTestBase {
resolvedHost: "mybucket.s3.us-west-2.amazonaws.com"
)

let config = try await S3Client.S3ClientConfiguration()
config.region = "us-west-2"
config.httpClientEngine = ProtocolTestClient()
config.idempotencyTokenGenerator = ProtocolTestIdempotencyTokenGenerator()
let config = try await S3Client.Config(
awsCredentialIdentityResolver: try SmithyTestUtil.dummyIdentityResolver(),
region: "us-west-2",
signingRegion: "us-west-2",
idempotencyTokenGenerator: ProtocolTestIdempotencyTokenGenerator(),
httpClientEngine: ProtocolTestClient()
)
let client = S3Client(config: config)

let input = DeleteObjectTaggingInput(
Expand Down
23 changes: 15 additions & 8 deletions Sources/Services/AWSS3/Tests/AWSS3Tests/GetObjectRequestTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Foundation
import Smithy
import SmithyTestUtil
import XCTest
import func SmithyTestUtil.dummyIdentityResolver


class GetObjectRequestTest: HttpRequestTestBase {
Expand All @@ -26,10 +27,13 @@ class GetObjectRequestTest: HttpRequestTestBase {
resolvedHost: "mybucket.s3.us-west-2.amazonaws.com"
)

let config = try await S3Client.S3ClientConfiguration()
config.region = "us-west-2"
config.httpClientEngine = ProtocolTestClient()
config.idempotencyTokenGenerator = ProtocolTestIdempotencyTokenGenerator()
let config = try await S3Client.Config(
awsCredentialIdentityResolver: try SmithyTestUtil.dummyIdentityResolver(),
region: "us-west-2",
signingRegion: "us-west-2",
idempotencyTokenGenerator: ProtocolTestIdempotencyTokenGenerator(),
httpClientEngine: ProtocolTestClient()
)
let client = S3Client(config: config)

let input = GetObjectInput(
Expand All @@ -52,10 +56,13 @@ class GetObjectRequestTest: HttpRequestTestBase {
resolvedHost: "mybucket.s3.us-west-2.amazonaws.com"
)

let config = try await S3Client.S3ClientConfiguration()
config.region = "us-west-2"
config.httpClientEngine = ProtocolTestClient()
config.idempotencyTokenGenerator = ProtocolTestIdempotencyTokenGenerator()
let config = try await S3Client.Config(
awsCredentialIdentityResolver: try SmithyTestUtil.dummyIdentityResolver(),
region: "us-west-2",
signingRegion: "us-west-2",
idempotencyTokenGenerator: ProtocolTestIdempotencyTokenGenerator(),
httpClientEngine: ProtocolTestClient()
)
let client = S3Client(config: config)

let input = GetObjectInput(
Expand Down
Loading

0 comments on commit 90ab3a8

Please sign in to comment.