Make certain request fields optional to unblock contract testing. #120
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.
Issue #, if available: #112 #109
Description of changes: This change makes some request fields optional/removes certain fields so that contract testing via
cfn test
can complete successfully without library errors. Below are a list of the changes to the request:Made
resourceType
,resourceTypeVersion
, andstackId
optional. MakingresourceType
optional led to some issues with metrics publishing, so I had to refactor the MetricPublisher and MetricsPublisherProxy. This led to the layout being much more in line with the java plugin, where the proxy has no required arugments for construction and simply loops through available publishers when publishing. Any arguments pertinent to metric publishing are now passed into the actual publisher class, like resource type name and provider session. The changes to metrics publishing also conditionally create the publisher and logging when there are provider logging credentials and a log group name.requestContext
is removed as this is a relic of the original protocol and no longer relevant.The first commit contains the bulk of these changes. The second commit just changes MetricPublisher->MetricsPublisher so the spelling is in line with the java plugin and the proxy :)
Testing done:
Created a dummy resource with the latest cloudformation-cli and ran cfn-test on a resource with this new support lib. Tests did not fail in the handler support lib like previously.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.