Skip to content

Commit 8cbff71

Browse files
authored
misc: enable smoke tests (#1194)
1 parent 394eb3b commit 8cbff71

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import software.amazon.smithy.kotlin.codegen.core.CodegenContext
55
import software.amazon.smithy.kotlin.codegen.core.DEFAULT_TEST_SOURCE_SET_ROOT
66
import software.amazon.smithy.kotlin.codegen.core.KotlinDelegator
77
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
8+
import software.amazon.smithy.kotlin.codegen.model.hasTrait
9+
import software.amazon.smithy.kotlin.codegen.utils.topDownOperations
810
import software.amazon.smithy.model.Model
911
import software.amazon.smithy.smoketests.traits.SmokeTestsTrait
1012

@@ -13,9 +15,7 @@ import software.amazon.smithy.smoketests.traits.SmokeTestsTrait
1315
*/
1416
class SmokeTestsIntegration : KotlinIntegration {
1517
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean =
16-
false
17-
// FIXME: Enable smoke tests again
18-
// model.topDownOperations(settings.service).any { it.hasTrait<SmokeTestsTrait>() }
18+
model.topDownOperations(settings.service).any { it.hasTrait<SmokeTestsTrait>() }
1919

2020
override fun writeAdditionalFiles(ctx: CodegenContext, delegator: KotlinDelegator) =
2121
delegator.useFileWriter(

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ object SmokeTestSectionIds {
3030
object HttpEngineOverride : SectionId
3131
object ServiceFilter : SectionId
3232
object SkipTags : SectionId
33+
object SmokeTestsFile : SectionId
3334
object ClientConfig : SectionId {
3435
val Name: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigName")
3536
val Value: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigValue")
@@ -59,16 +60,18 @@ class SmokeTestsRunnerGenerator(
5960
ctx: CodegenContext,
6061
) {
6162
internal fun render() {
62-
writer.write("private var exitCode = 0")
63-
renderEnvironmentVariables()
64-
writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables)
65-
writer.write("")
66-
writer.withBlock("public suspend fun main() {", "}") {
67-
renderFunctionCalls()
68-
write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess)
63+
writer.declareSection(SmokeTestSectionIds.SmokeTestsFile) {
64+
writer.write("private var exitCode = 0")
65+
renderEnvironmentVariables()
66+
writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables)
67+
writer.write("")
68+
writer.withBlock("public suspend fun main() {", "}") {
69+
renderFunctionCalls()
70+
write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess)
71+
}
72+
writer.write("")
73+
renderFunctions()
6974
}
70-
writer.write("")
71-
renderFunctions()
7275
}
7376

7477
private fun renderEnvironmentVariables() {

0 commit comments

Comments
 (0)