-
Notifications
You must be signed in to change notification settings - Fork 50
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: smoke tests #1388
Merged
Merged
feat: smoke tests #1388
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
602bac1
feat: smoke tests
0marperez 989d8ec
Merge branch 'main' of https://github.com/awslabs/aws-sdk-kotlin into…
0marperez 9ca8f2e
Sending verified commit to trigger CI
0marperez b00ec1f
Actually sign commit message[B
0marperez 35708df
PR feedback
0marperez 2399355
Remove error log commited by accident
0marperez 2d98a99
Add TODO
0marperez d7a4877
Added E2E tests
0marperez f390f6a
Remove dangerous gradle task, move sdk denylist check to codegen inst…
0marperez 90a93ac
Fix kotlin native builds failing
0marperez 6b288ed
Temp print statement to debug
0marperez c6701cb
Change debugging print to exception
0marperez 95b553d
chmod gradlew before tests
0marperez 5ac3db2
Use gradlew.bat
0marperez ca30211
ls sdk root dir
0marperez 08356db
Use gradle connector instead of process builder
0marperez e7fdeff
build before testing
0marperez 8f0dec1
increase gradle connection timeout
0marperez 431e63e
run from sdk root dir, better logging, use explicit gradle distributi…
0marperez 1706764
Enable gradle daemon with an idle timeout, increment internal timeout
0marperez bb53c3d
use gradle runner instead of connector
0marperez e13e9fc
Specify smokeTests to run & better test failure logging
0marperez afc5168
fix parallel task execution issues
0marperez c39f3fe
move task dependency from ci tests to code
0marperez 5dfd004
easy to fix PR feedback and decoupling SmokeTestRunnerGenerator from SDK
0marperez 87fa6bb
Merge branch 'main' of https://github.com/awslabs/aws-sdk-kotlin into…
0marperez c1e0edf
Remove accidental changes to AWS model
0marperez dfcffbb
Run smoke tests in common
0marperez 25b8e8e
Self nits
0marperez 8aae6e4
Use new runtime function for env vars
0marperez 5687f7e
Cleanup, Clarity changes to test code in src
0marperez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"id": "ab4f3405-e013-4caf-89d7-1d820bcdd228", | ||
"type": "feature", | ||
"description": "Add support for smoke tests" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,16 @@ | |
*/ | ||
package aws.sdk.kotlin.codegen | ||
|
||
import software.amazon.smithy.kotlin.codegen.KotlinSettings | ||
import software.amazon.smithy.kotlin.codegen.core.* | ||
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration | ||
import software.amazon.smithy.kotlin.codegen.model.hasTrait | ||
import software.amazon.smithy.kotlin.codegen.rendering.GradleWriter | ||
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.smokeTestDenyList | ||
import software.amazon.smithy.kotlin.codegen.utils.operations | ||
import software.amazon.smithy.model.Model | ||
import software.amazon.smithy.smoketests.traits.SmokeTestsTrait | ||
import java.util.concurrent.atomic.AtomicBoolean | ||
|
||
// TODO - would be nice to allow integrations to define custom settings in the plugin | ||
// e.g. we could then more consistently apply this integration if we could define a property like: `build.isAwsSdk: true` | ||
|
@@ -16,6 +23,14 @@ import software.amazon.smithy.kotlin.codegen.rendering.GradleWriter | |
*/ | ||
class GradleGenerator : KotlinIntegration { | ||
|
||
private var hasSmokeTests = AtomicBoolean(false) | ||
|
||
// Only used to access settings - will always be true | ||
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean { | ||
hasSmokeTests.set(model.operations(settings.service).any { it.hasTrait<SmokeTestsTrait>() }) | ||
return super.enabledForService(model, settings) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can access |
||
// Specify to run last, to ensure all other integrations have had a chance to register dependencies. | ||
override val order: Byte | ||
get() = 127 | ||
|
@@ -50,6 +65,10 @@ class GradleGenerator : KotlinIntegration { | |
writer | ||
.write("") | ||
.withBlock("kotlin {", "}") { | ||
if (hasSmokeTests.get() && !smokeTestDenyList.contains(ctx.settings.sdkId)) { | ||
generateSmokeTestJarTask(writer) | ||
generateSmokeTestTask(writer) | ||
} | ||
withBlock("sourceSets {", "}") { | ||
allDependencies | ||
.sortedWith(compareBy({ it.config }, { it.artifact })) | ||
|
@@ -69,4 +88,41 @@ class GradleGenerator : KotlinIntegration { | |
val contents = writer.toString() | ||
delegator.fileManifest.writeFile("build.gradle.kts", contents) | ||
} | ||
|
||
private fun generateSmokeTestJarTask(writer: GradleWriter) { | ||
val moneySign = "$" | ||
writer.withBlock("jvm {", "}") { | ||
withBlock("compilations {", "}") { | ||
write("val main = getByName(\"main\")") | ||
withBlock("tasks {", "}") { | ||
withBlock("register<Jar>(\"smokeTestJar\") {", "}") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use #S instead of managing the quotes yourself |
||
write("description = \"Creates smoke tests jar\"") | ||
write("group = \"application\"") | ||
write("dependsOn(build)") | ||
withBlock("manifest {", "}") { | ||
write("attributes[\"Main-Class\"] = \"smoketests.SmokeTestsKt\"") | ||
} | ||
write("duplicatesStrategy = DuplicatesStrategy.EXCLUDE") | ||
write("from(configurations.getByName(\"jvmRuntimeClasspath\").map { if (it.isDirectory) it else zipTree(it) }, main.output.classesDirs)") | ||
write("archiveBaseName.set(\"$moneySign{project.name}-smoketests\")") | ||
} | ||
} | ||
} | ||
} | ||
writer.emptyLine() | ||
} | ||
|
||
private fun generateSmokeTestTask(writer: GradleWriter) { | ||
val moneySign = "$" | ||
writer.withBlock("tasks.register<JavaExec>(\"smokeTest\") {", "}") { | ||
write("description = \"Runs smoke tests jar\"") | ||
write("group = \"verification\"") | ||
write("dependsOn(tasks.getByName(\"smokeTestJar\"))") | ||
emptyLine() | ||
write("val sdkVersion: String by project") | ||
write("val jarFile = file(\"build/libs/$moneySign{project.name}-smoketests-\$sdkVersion.jar\")") | ||
write("classpath = files(jarFile)") | ||
} | ||
writer.emptyLine() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opinion: I don't think we need a changelog entry here in aws-sdk-kotlin, it's not customer-facing