Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez committed Nov 6, 2024
1 parent c6ab629 commit 93c850b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private object AwsSmokeTestsRunnerGenerator {
* Preserves other environment variables added via section writer binding, if any.
*/
val regionEnvironmentVariable =
SectionWriterBinding(AdditionalEnvironmentVariables) { writer, previous ->
SectionWriterBinding(SmokeTestSectionIds.AdditionalEnvironmentVariables) { writer, previous ->
writer.write("#L", previous)
writer.write(
"private val regionOverride = #T.System.getenv(#S)",
Expand All @@ -52,9 +52,9 @@ private object AwsSmokeTestsRunnerGenerator {
* Add AWS specific client config support to AWS smoke test runners
*/
val clientConfig =
SectionWriterBinding(ClientConfig) { writer, _ ->
val name = writer.getContextValue(ClientConfig.Name)
val value = writer.getContextValue(ClientConfig.Value)
SectionWriterBinding(SmokeTestSectionIds.ClientConfig) { writer, _ ->
val name = writer.getContextValue(SmokeTestSectionIds.ClientConfig.Name)
val value = writer.getContextValue(SmokeTestSectionIds.ClientConfig.Value)

// Normalize client config names
val newName = when (name) {
Expand All @@ -65,7 +65,7 @@ private object AwsSmokeTestsRunnerGenerator {
"useAccelerate" -> "enableAccelerate"
"useMultiRegionAccessPoints" -> "disableMrap"
"useGlobalEndpoint" -> {
writer.write("throw Exception(#S)", "'useGlobalEndpoint' is not supported by the SDK")
writer.write("throw #T(#S)", RuntimeTypes.Core.SmokeTests.SmokeTestsException, "'useGlobalEndpoint' is not supported by the SDK")
return@SectionWriterBinding
}
else -> name
Expand All @@ -75,8 +75,8 @@ private object AwsSmokeTestsRunnerGenerator {
// Normalize client values
when (newName) {
"endpointProvider" -> {
val endpointProvider = writer.getContextValue(ClientConfig.EndpointProvider)
val endpointParameters = writer.getContextValue(ClientConfig.EndpointParams)
val endpointProvider = writer.getContextValue(SmokeTestSectionIds.ClientConfig.EndpointProvider)
val endpointParameters = writer.getContextValue(SmokeTestSectionIds.ClientConfig.EndpointParams)

writer.withBlock("object : #T {", "}", endpointProvider) {
write(
Expand Down Expand Up @@ -121,7 +121,7 @@ private object AwsSmokeTestsRunnerGenerator {
* Preserves previous default config if any.
*/
val defaultClientConfig =
SectionWriterBinding(DefaultClientConfig) { writer, previous ->
SectionWriterBinding(SmokeTestSectionIds.DefaultClientConfig) { writer, previous ->
writer.write("#L", previous)
writer.write("region = regionOverride")
}
Expand All @@ -130,13 +130,13 @@ private object AwsSmokeTestsRunnerGenerator {
* Replaces environment variable with one specific to AWS smoke test runners
*/
val skipTagsEnvironmentVariable =
SectionWriterBinding(SkipTags) { writer, _ -> writer.writeInline("#S", AWS_SKIP_TAGS) }
SectionWriterBinding(SmokeTestSectionIds.SkipTags) { writer, _ -> writer.writeInline("#S", AWS_SKIP_TAGS) }

/**
* Replaces environment variable with one specific to AWS smoke test runners
*/
val serviceFilterEnvironmentVariable =
SectionWriterBinding(ServiceFilter) { writer, _ -> writer.writeInline("#S", AWS_SERVICE_FILTER) }
SectionWriterBinding(SmokeTestSectionIds.ServiceFilter) { writer, _ -> writer.writeInline("#S", AWS_SERVICE_FILTER) }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import software.amazon.smithy.kotlin.codegen.integration.SectionWriter
import software.amazon.smithy.kotlin.codegen.integration.SectionWriterBinding
import software.amazon.smithy.kotlin.codegen.model.expectShape
import software.amazon.smithy.kotlin.codegen.model.hasTrait
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.HttpEngineOverride
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestSectionIds
import software.amazon.smithy.kotlin.codegen.utils.topDownOperations
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.ServiceShape
Expand All @@ -29,7 +29,7 @@ class SmokeTestFailHttpEngineIntegration : KotlinIntegration {

override val sectionWriters: List<SectionWriterBinding>
get() = listOf(
SectionWriterBinding(HttpEngineOverride, httpClientOverride),
SectionWriterBinding(SmokeTestSectionIds.HttpEngineOverride, httpClientOverride),
)

private val httpClientOverride = SectionWriter { writer, _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import software.amazon.smithy.kotlin.codegen.integration.SectionWriter
import software.amazon.smithy.kotlin.codegen.integration.SectionWriterBinding
import software.amazon.smithy.kotlin.codegen.model.expectShape
import software.amazon.smithy.kotlin.codegen.model.hasTrait
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.HttpEngineOverride
import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestSectionIds
import software.amazon.smithy.kotlin.codegen.utils.topDownOperations
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.ServiceShape
Expand All @@ -28,7 +28,7 @@ class SmokeTestSuccessHttpEngineIntegration : KotlinIntegration {

override val sectionWriters: List<SectionWriterBinding>
get() = listOf(
SectionWriterBinding(HttpEngineOverride, httpClientOverride),
SectionWriterBinding(SmokeTestSectionIds.HttpEngineOverride, httpClientOverride),
)

private val httpClientOverride = SectionWriter { writer, _ ->
Expand Down

0 comments on commit 93c850b

Please sign in to comment.