Skip to content

Commit 04933e0

Browse files
committed
PR feedback #2
1 parent 44dfed5 commit 04933e0

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ object RuntimeTypes {
117117
object SmokeTests : RuntimeTypePackage(KotlinDependency.CORE, "smoketests") {
118118
val exitProcess = symbol("exitProcess")
119119
val printExceptionStackTrace = symbol("printExceptionStackTrace")
120+
val SmokeTestsException = symbol("SmokeTestsException")
120121
}
121122

122123
object Collections : RuntimeTypePackage(KotlinDependency.CORE, "collections") {

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import software.amazon.smithy.kotlin.codegen.model.isStringEnumShape
1010
import software.amazon.smithy.kotlin.codegen.rendering.endpoints.EndpointParametersGenerator
1111
import software.amazon.smithy.kotlin.codegen.rendering.endpoints.EndpointProviderGenerator
1212
import software.amazon.smithy.kotlin.codegen.rendering.protocol.stringToNumber
13-
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.ClientConfig.EndpointParams
14-
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.ClientConfig.EndpointProvider
15-
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.ClientConfig.Name
16-
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.ClientConfig.Value
13+
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestSectionIds.ClientConfig.EndpointParams
14+
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestSectionIds.ClientConfig.EndpointProvider
15+
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestSectionIds.ClientConfig.Name
16+
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestSectionIds.ClientConfig.Value
1717
import software.amazon.smithy.kotlin.codegen.rendering.util.format
1818
import software.amazon.smithy.kotlin.codegen.utils.dq
1919
import software.amazon.smithy.kotlin.codegen.utils.toCamelCase
@@ -26,16 +26,18 @@ import software.amazon.smithy.smoketests.traits.SmokeTestsTrait
2626
import kotlin.jvm.optionals.getOrNull
2727

2828
// Section IDs
29-
object AdditionalEnvironmentVariables : SectionId
30-
object DefaultClientConfig : SectionId
31-
object HttpEngineOverride : SectionId
32-
object ServiceFilter : SectionId
33-
object SkipTags : SectionId
34-
object ClientConfig : SectionId {
35-
val Name: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigName")
36-
val Value: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigValue")
37-
val EndpointProvider: SectionKey<Symbol> = SectionKey("aws.smithy.kotlin#SmokeTestEndpointProvider")
38-
val EndpointParams: SectionKey<Symbol> = SectionKey("aws.smithy.kotlin#SmokeTestClientEndpointParams")
29+
object SmokeTestSectionIds {
30+
object AdditionalEnvironmentVariables : SectionId
31+
object DefaultClientConfig : SectionId
32+
object HttpEngineOverride : SectionId
33+
object ServiceFilter : SectionId
34+
object SkipTags : SectionId
35+
object ClientConfig : SectionId {
36+
val Name: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigName")
37+
val Value: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigValue")
38+
val EndpointProvider: SectionKey<Symbol> = SectionKey("aws.smithy.kotlin#SmokeTestEndpointProvider")
39+
val EndpointParams: SectionKey<Symbol> = SectionKey("aws.smithy.kotlin#SmokeTestClientEndpointParams")
40+
}
3941
}
4042

4143
/**
@@ -61,7 +63,7 @@ class SmokeTestsRunnerGenerator(
6163
internal fun render() {
6264
writer.write("private var exitCode = 0")
6365
renderEnvironmentVariables()
64-
writer.declareSection(AdditionalEnvironmentVariables)
66+
writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables)
6567
writer.write("")
6668
writer.withBlock("public suspend fun main() {", "}") {
6769
renderFunctionCalls()
@@ -77,7 +79,7 @@ class SmokeTestsRunnerGenerator(
7779
"private val skipTags = #T.System.getenv(",
7880
RuntimeTypes.Core.Utils.PlatformProvider,
7981
)
80-
writer.declareSection(SkipTags) {
82+
writer.declareSection(SmokeTestSectionIds.SkipTags) {
8183
writer.writeInline("#S", SKIP_TAGS)
8284
}
8385
writer.write(
@@ -90,7 +92,7 @@ class SmokeTestsRunnerGenerator(
9092
"private val serviceFilter = #T.System.getenv(",
9193
RuntimeTypes.Core.Utils.PlatformProvider,
9294
)
93-
writer.declareSection(ServiceFilter) {
95+
writer.declareSection(SmokeTestSectionIds.ServiceFilter) {
9496
writer.writeInline("#S", SERVICE_FILTER)
9597
}
9698
writer.write(
@@ -152,10 +154,10 @@ class SmokeTestsRunnerGenerator(
152154
writer.write("interceptors.add(#T())", RuntimeTypes.HttpClient.Interceptors.SmokeTestsInterceptor)
153155
}
154156

155-
writer.declareSection(HttpEngineOverride)
157+
writer.declareSection(SmokeTestSectionIds.HttpEngineOverride)
156158

157159
if (!testCase.hasClientConfig) {
158-
writer.declareSection(DefaultClientConfig)
160+
writer.declareSection(SmokeTestSectionIds.DefaultClientConfig)
159161
return
160162
}
161163

@@ -164,7 +166,7 @@ class SmokeTestsRunnerGenerator(
164166
val value = config.value.format()
165167

166168
writer.declareSection(
167-
ClientConfig,
169+
SmokeTestSectionIds.ClientConfig,
168170
mapOf(
169171
Name to name,
170172
Value to value,

runtime/runtime-core/api/runtime-core.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,6 +2046,10 @@ public final class aws/smithy/kotlin/runtime/retries/policy/SuccessAcceptor : aw
20462046
public final fun getSuccess ()Z
20472047
}
20482048

2049+
public final class aws/smithy/kotlin/runtime/smoketests/SmokeTestsException : java/lang/Exception {
2050+
public fun <init> (Ljava/lang/String;)V
2051+
}
2052+
20492053
public final class aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctionsJVMKt {
20502054
public static final fun exitProcess (I)Ljava/lang/Void;
20512055
}

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/smoketests/SmokeTestsFunctions.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ public expect fun exitProcess(status: Int): Nothing
1717
*/
1818
public fun printExceptionStackTrace(exception: Exception): Unit =
1919
println(exception.stackTraceToString().split("\n").joinToString("\n") { "#$it" })
20+
21+
public class SmokeTestsException(message: String) : Exception(message)

0 commit comments

Comments
 (0)