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

misc: make route 53 uri tests resilient to model version changes #1540

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

0marperez
Copy link
Contributor

Issue #

closes #1370

Description of changes

Refactors modeled tests into E2E tests that are resilient to model version changes

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

@0marperez 0marperez added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Feb 27, 2025
@0marperez 0marperez changed the title Route53 hardcoded tests misc: make route 53 uri tests resilient to model version changes Feb 27, 2025
Copy link

A new generated diff is ready to view.

Copy link

A new generated diff is ready to view.

This comment has been minimized.

Copy link

A new generated diff is ready to view.

This comment has been minimized.

@0marperez 0marperez marked this pull request as ready for review February 27, 2025 16:36
@0marperez 0marperez requested a review from a team as a code owner February 27, 2025 16:36
Comment on lines 73 to 81

// `Route53UriTest` E2E tests depend on `TestEngine`
if (ctx.model.expectShape<ServiceShape>(ctx.settings.service).sdkId.lowercase() == "route 53") {
withBlock("jvmE2eTest {", "}") {
withBlock("dependencies {", "}") {
write(KotlinDependency.HTTP_TEST.dependencyNotation())
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Correctness: We shouldn't hardcode this service-specific logic into the main GradleGenerator. We should either:

  • Create a Section and a customization for Route53 which adds the necessary code in that section –or–
  • Just add the http-test dependency to the E2E source set for all services

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried creating a Section and a customization for Route53 but our section logic doesn't seem to handle sections in KotlinIntegrations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just add the http-test dependency to the E2E source set for all services

You mean hardcoding it how it is now but for every service? i.e. removing the if statement

Copy link
Member

Choose a reason for hiding this comment

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

our section logic doesn't seem to handle sections in KotlinIntegrations

What do you mean by that? We use SectionWriter all over in our integrations: https://github.com/search?q=repo%3Aawslabs%2Faws-sdk-kotlin%20path%3A%2F%5Ecodegen%5C%2Faws-sdk-codegen%5C%2Fsrc%5C%2Fmain%5C%2Fkotlin%5C%2Faws%5C%2Fsdk%5C%2Fkotlin%5C%2Fcodegen%5C%2F%2F%20sectionWriter&type=code

Copy link
Contributor Author

@0marperez 0marperez Feb 27, 2025

Choose a reason for hiding this comment

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

Oh I meant a SectionId that is declared in a KotlinIntegration can't be processed by a SectionWriter in another KotlinIntegration

Copy link
Member

@lauzadis lauzadis Feb 27, 2025

Choose a reason for hiding this comment

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

Oh ok. I think it should as long as the SectionId is accessible and the order is set up correctly? If not, I'd say that's a bug and we should open an issue for it

I also think just adding the http-test dependency to all services is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, I'll try again later and open an issue for it if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I meant a SectionId that is declared in a KotlinIntegration can't be processed by a SectionWriter in another KotlinIntegration

I found out why this isn't working for the GradleGenerator, it's because of the way that the build.gradle.kts file is created. The GradleGenerator uses the fileManifest instead of useFileWriter so this step is skipped

Comment on lines 74 to 78
withBlock("jvmE2eTest {", "}") {
withBlock("dependencies {", "}") {
write(KotlinDependency.HTTP_TEST.dependencyNotation())
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Sorry I may have been misleading in the last thread. You can't do this in the GradleGenerator because not every service will have a jvmE2eTest source set. You'll need to add it to E2E test dependencies another way. I think we have a different part of the codebase that maintains a list of E2E test dependencies

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

You could also just add another case if (project.name == "route53") to scope this down again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

A new generated diff is ready to view.

This comment has been minimized.

@@ -75,6 +75,7 @@ subprojects {
implementation(libraries.kotlin.test.junit5)
implementation(project(":tests:e2e-test-util"))
implementation(libraries.slf4j.simple)
implementation(libraries.smithy.kotlin.http.test)
Copy link
Member

Choose a reason for hiding this comment

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

Can this be scoped down using if (project.name == "route53") { ... }? Similar to how we do it for other services.

Copy link

A new generated diff is ready to view.

Copy link

Affected Artifacts

Changed in size
Artifact Pull Request (bytes) Latest Release (bytes) Delta (bytes) Delta (percentage)
ec2instanceconnect-jvm.jar closure 8,087,926 8,087,933 -7 -0.00%
polly-jvm.jar closure 8,555,994 8,556,003 -9 -0.00%
polly-jvm.jar 679,961 679,970 -9 -0.00%
ec2instanceconnect-jvm.jar 211,893 211,900 -7 -0.00%
qbusiness-jvm.jar closure 11,680,393 11,697,220 -16,827 -0.14%
storagegateway-jvm.jar closure 10,790,452 10,811,720 -21,268 -0.20%
sagemaker-jvm.jar closure 27,739,425 27,801,223 -61,798 -0.22%
sagemaker-jvm.jar 19,863,392 19,925,190 -61,798 -0.31%
qbusiness-jvm.jar 3,720,153 3,736,980 -16,827 -0.45%
redshiftserverless-jvm.jar closure 9,733,299 9,802,391 -69,092 -0.70%
storagegateway-jvm.jar 2,914,419 2,935,687 -21,268 -0.72%
redshiftserverless-jvm.jar 1,857,266 1,926,358 -69,092 -3.59%
bedrockagentruntime-jvm.jar closure 10,696,645 11,134,748 -438,103 -3.93%
bedrockagentruntime-jvm.jar 2,736,405 3,174,508 -438,103 -13.80%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update or replace hardcoded Route53 tests
3 participants