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

feat: add ability to run protocol tests as unit tests of a service #1590

Merged
merged 59 commits into from
Jul 5, 2024

Conversation

dayaffe
Copy link
Collaborator

@dayaffe dayaffe commented Jun 25, 2024

Issue #

Description of changes

  • SignerMiddleware will check and update signing properties with X-Amz-Content-Sha256 if it is pre-computed by SHA256 middleware
  • SHA256 Middleware now occurs before signing rather than before transmit. It also no longer adds the X-Amz-Content-Sha256 header and instead computes the value and passes it to CRT to add during signing. (Glacier fix)
  • Create s3-tests.smithy with protocol tests that require using the actual service client. These tests will get generated and copied into the relevant service client test folder.

New/existing dependencies impact assessment, if applicable

Conventional Commits

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:XCTestPlans/ProtocolTestPlan.xctestplan"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to upload the scheme so that we ensure it includes our reference to using ProtocolTestPlan

Comment on lines +27 to +28
"S3PreservesEmbeddedDotSegmentInUriLabel", // moved to s3-tests.smithy
"S3PreservesLeadingDotSegmentInUriLabel", // moved to s3-tests.smithy
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests that have been moved to s3-tests.smithy would still remain ignored here for when they are pulled from smithy. They have been copied and renamed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tests that have been copied over to s3-tests.smithy are modified or added to, how will we know (other than manually checking those test models)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they'll continue to be marked as disabled here with a comment noting they've been moved. Another place to check is in AdditionalServiceTests/ folder for the smithy file

Copy link
Contributor

@jbelkins jbelkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good, but it appears there are several things in test setup & config that can be eliminated.

@@ -6,6 +6,9 @@ on:
workflow_dispatch:
pull_request:

permissions:
id-token: write

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Doesn't look like we use write in this job.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try removing it

.github/workflows/continuous-integration.yml Outdated Show resolved Hide resolved
.github/workflows/codegen-build-test.yml Show resolved Hide resolved
method: .delete,
path: "/my%20key.txt",
headers: [
"Content-Type": "application/json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this PR need to have its codegen updated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes it does

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name matches the scheme that Xcode auto-generates for a package. Are you sure we need this to be committed explicitly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesnt need to be committed as it will get generated, but I thought we keep Sources/Services/ codegen committed and up to date?

@@ -109,8 +112,10 @@ jobs:
run: |
cd codegen/
set -o pipefail && \
NSUnbufferedIO=YES xcodebuild \
xcodebuild -showTestPlans -scheme aws-sdk-swift-protocol-tests-Package && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this here just for troubleshooting? Can we get rid of it?

@dayaffe dayaffe requested a review from jbelkins July 3, 2024 20:39
.github/workflows/continuous-integration.yml Outdated Show resolved Hide resolved
@@ -7,6 +7,9 @@ on:
env:
AWS_SWIFT_SDK_USE_LOCAL_DEPS: 1

permissions:
id-token: write

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure we can't get rid of these extra permissions in CI? IIRC this is needed to get AWS credentials through OpenID which we don't do in the CI workflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the linux side I'm using aws-actions/configure-aws-credentials@v3 still. Would rather I try to change this one to fake credentials?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's not get real credentials where fake ones will do

Comment on lines +27 to +28
"S3PreservesEmbeddedDotSegmentInUriLabel", // moved to s3-tests.smithy
"S3PreservesLeadingDotSegmentInUriLabel", // moved to s3-tests.smithy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tests that have been copied over to s3-tests.smithy are modified or added to, how will we know (other than manually checking those test models)?

@dayaffe dayaffe requested a review from jbelkins July 5, 2024 20:28
@dayaffe dayaffe merged commit e550145 into main Jul 5, 2024
29 checks passed
@dayaffe dayaffe deleted the day/enable-s3-tests branch July 5, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants