Skip to content

Commit

Permalink
Update to Smithy 1.37.0, disable selected protocol tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins committed Sep 13, 2023
1 parent 806ca22 commit 6a7ab36
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 42 deletions.
20 changes: 4 additions & 16 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,11 @@ func addServiceTarget(_ name: String) {

func addIntegrationTestTarget(_ name: String) {
let integrationTestName = "\(name)IntegrationTests"
var additionalDependencies: [PackageDescription.Target.Dependency] = []
var exclusions: [String] = []
switch name {
case "AWSECS":
additionalDependencies = ["AWSCloudWatchLogs", "AWSEC2", "AWSIAM"]
exclusions = [
"README.md",
"Resources/ECSIntegTestApp/"
]
default:
break
}
package.targets += [
.testTarget(
name: integrationTestName,
dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils] + additionalDependencies,
dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils],
path: "./IntegrationTests/Services/\(integrationTestName)",
exclude: exclusions,
resources: [.process("Resources")]
)
]
Expand Down Expand Up @@ -369,7 +356,6 @@ let serviceTargets: [String] = [
"AWSKinesisAnalytics",
"AWSKinesisAnalyticsV2",
"AWSKinesisVideo",
"AWSKinesisVideoArchivedMedia",
"AWSKinesisVideoMedia",
"AWSKinesisVideoSignaling",
"AWSKinesisVideoWebRTCStorage",
Expand Down Expand Up @@ -419,6 +405,7 @@ let serviceTargets: [String] = [
"AWSMobile",
"AWSMq",
"AWSNeptune",
"AWSNeptunedata",
"AWSNetworkFirewall",
"AWSNetworkManager",
"AWSNimble",
Expand All @@ -435,6 +422,7 @@ let serviceTargets: [String] = [
"AWSPanorama",
"AWSPaymentCryptography",
"AWSPaymentCryptographyData",
"AWSPcaConnectorAd",
"AWSPersonalize",
"AWSPersonalizeEvents",
"AWSPersonalizeRuntime",
Expand Down Expand Up @@ -549,4 +537,4 @@ let servicesWithIntegrationTests: [String] = [
servicesWithIntegrationTests.forEach(addIntegrationTestTarget)

// Uncomment this line to enable protocol tests
// addProtocolTests()
addProtocolTests()
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ abstract class AWSHttpBindingProtocolGenerator : HttpBindingProtocolGenerator()
val requestTestBuilder = HttpProtocolUnitTestRequestGenerator.Builder()
val responseTestBuilder = HttpProtocolUnitTestResponseGenerator.Builder()
val errorTestBuilder = HttpProtocolUnitTestErrorGenerator.Builder()
open val testsToIgnore: Set<String> = setOf()

override val shouldRenderDecodableBodyStructForInputShapes = true
override val shouldRenderCodingKeysForEncodable = true
Expand All @@ -68,6 +69,7 @@ abstract class AWSHttpBindingProtocolGenerator : HttpBindingProtocolGenerator()
getProtocolHttpBindingResolver(ctx, defaultContentType),
serdeContext,
imports,
testsToIgnore
).generateProtocolTests() + renderEndpointsTests(ctx)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ open class AwsJson1_0_ProtocolGenerator : AWSHttpBindingProtocolGenerator() {
override val serdeContext = serdeContextJSON
override val shouldRenderEncodableConformance: Boolean = true
override val shouldRenderDecodableBodyStructForInputShapes: Boolean = true
override val testsToIgnore = setOf(
"SDKAppliedContentEncoding_awsJson1_0",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_0"
)
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
HttpBindingResolver = AwsJsonHttpBindingResolver(ctx, defaultContentType)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class AwsJson1_1_ProtocolGenerator : AWSHttpBindingProtocolGenerator() {
override val serdeContext = serdeContextJSON
override val shouldRenderEncodableConformance: Boolean = true
override val shouldRenderDecodableBodyStructForInputShapes: Boolean = true
override val testsToIgnore = setOf(
"SDKAppliedContentEncoding_awsJson1_1",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1"
)
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
HttpBindingResolver = AwsJsonHttpBindingResolver(ctx, defaultContentType)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() {
override val shouldRenderDecodableBodyStructForInputShapes = false
override val shouldRenderCodingKeysForEncodable = false
override val shouldRenderEncodableConformance = true
override val testsToIgnore = setOf(
"SDKAppliedContentEncoding_awsQuery",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery"
)
override fun renderStructEncode(
ctx: ProtocolGenerator.GenerationContext,
shapeContainingMembers: Shape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() {
override val shouldRenderDecodableBodyStructForInputShapes = false
override val shouldRenderCodingKeysForEncodable = false
override val shouldRenderEncodableConformance = true
override val testsToIgnore = setOf(
"SDKAppliedContentEncoding_ec2Query",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_ec2Query"
)
override fun renderStructEncode(
ctx: ProtocolGenerator.GenerationContext,
shapeContainingMembers: Shape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class AWSRestJson1ProtocolGenerator : AWSHttpBindingProtocolGenerator() {
AWSRestJson1HttpResponseBindingErrorGeneratable()
)
override val serdeContext = serdeContextJSON
override val testsToIgnore = setOf(
"SDKAppliedContentEncoding_restJson1",
"SDKAppendedGzipAfterProvidedEncoding_restJson1"
)

override fun generateMessageMarshallable(ctx: ProtocolGenerator.GenerationContext) {
var streamingShapes = outputStreamingShapes(ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() {
AWSXMLHttpResponseBindingErrorInitGeneratorFactory()
)
override val serdeContext = serdeContextXML
override val testsToIgnore = setOf(
"S3DefaultAddressing",
"S3VirtualHostAddressing",
"S3PathAddressing",
"S3VirtualHostDualstackAddressing",
"S3VirtualHostAccelerateAddressing",
"S3VirtualHostDualstackAccelerateAddressing",
"S3OperationAddressingPreferred",
"S3EscapeObjectKeyInUriLabel",
"S3EscapePathObjectKeyInUriLabel",
"SDKAppliedContentEncoding_restXml",
"SDKAppendedGzipAfterProvidedEncoding_restXml"
)

override fun renderStructEncode(
ctx: ProtocolGenerator.GenerationContext,
Expand Down Expand Up @@ -64,28 +77,4 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() {
val decoder = RestXmlStructDecodeXMLGenerator(ctx, members, shapeMetadata, writer, defaultTimestampFormat)
decoder.render()
}

override fun generateProtocolUnitTests(ctx: ProtocolGenerator.GenerationContext): Int {
val testsToIgnore = setOf(
"S3DefaultAddressing",
"S3VirtualHostAddressing",
"S3PathAddressing",
"S3VirtualHostDualstackAddressing",
"S3VirtualHostAccelerateAddressing",
"S3VirtualHostDualstackAccelerateAddressing",
"S3OperationAddressingPreferred"
)
return HttpProtocolTestGenerator(
ctx,
requestTestBuilder,
responseTestBuilder,
errorTestBuilder,
httpProtocolCustomizable,
operationMiddleware,
getProtocolHttpBindingResolver(ctx, defaultContentType),
serdeContext,
listOf(),
testsToIgnore
).generateProtocolTests() + renderEndpointsTests(ctx)
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kotlin.code.style=official

# codegen
smithyVersion=1.30.0
smithyVersion=1.37.0
smithyGradleVersion=0.6.0

smithySwiftVersion = 0.1.0
Expand Down

0 comments on commit 6a7ab36

Please sign in to comment.