Contract test failing when it should succeed
Running on this resource provider: https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-amplifyuibuilder/tree/main/aws-amplifyuibuilder-component
With this input: inputs_1_create.json.zip
This is the fail error I see:
FAILED handler_create.py::contract_create_delete - AssertionError: All properties specified in the request MUST be present in the model returned, and they MUST match exactly, with ...
I think this test should succeed because the CREATE and DELETE requests succeed and the ResourceModel properties in the CREATE request are the same as the ones returned and in the same order. I logged out the ResourceModel and did a diff between the CREATE request and the return. The only diff was the Id primary identifier, which is expected.
contract-test-output.txt sam-lambda-output.txt
Here is the ResourceModel sent to a CREATE request
ResourceModel(appId=d3mp13l4ewcp1, bindingProperties={buttonUser=ComponentBindingPropertiesValue(defaultValue=null, type=Data, bindingProperties=ComponentBindingPropertiesValueProperties(field=null, defaultValue=null, bucket=null, userAttribute=null, model=User, predicates=[], key=null)), buttonColor=ComponentBindingPropertiesValue(defaultValue=null, type=String, bindingProperties=null), width=ComponentBindingPropertiesValue(defaultValue=null, type=Number, bindingProperties=null)}, children=[], collectionProperties={}, componentType=Button, createdAt=null, environmentName=staging, id=null, modifiedAt=null, name=ContractTestComponent, overrides={}, properties={backgroundColor=ComponentProperty(condition=ComponentConditionProperty(operator=eq, field=isLoggedIn, operand=true, else_=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=loggedOutColor, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), then=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=loggedInColor, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), property=buttonUser), userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), disabled=ComponentProperty(condition=ComponentConditionProperty(operator=eq, field=isLoggedIn, operand=true, else_=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=false, model=null, collectionBindingProperties=null, event=null), then=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=true, model=null, collectionBindingProperties=null, event=null), property=buttonUser), userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), labelWidth=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=null, property=width), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), label=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=firstName, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=Spain, type=null, value=null, model=null, collectionBindingProperties=null, event=null)], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), prompt=ComponentProperty(condition=ComponentConditionProperty(operator=gt, field=age, operand=18, else_=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=Sorry you cannot vote, model=null, collectionBindingProperties=null, event=null), then=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=firstname, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=, cast your vote., model=null, collectionBindingProperties=null, event=null)], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), property=buttonUser), userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null)}, sourceId=null, tags={}, variants=[])
Here is the ResourceModel returned from the CREATE request
ResourceModel(appId=d3mp13l4ewcp1, bindingProperties={buttonUser=ComponentBindingPropertiesValue(defaultValue=null, type=Data, bindingProperties=ComponentBindingPropertiesValueProperties(field=null, defaultValue=null, bucket=null, userAttribute=null, model=User, predicates=[], key=null)), buttonColor=ComponentBindingPropertiesValue(defaultValue=null, type=String, bindingProperties=null), width=ComponentBindingPropertiesValue(defaultValue=null, type=Number, bindingProperties=null)}, children=[], collectionProperties={}, componentType=Button, createdAt=null, environmentName=staging, id=c-48rxx9Ai9b0Q16BKlP, modifiedAt=null, name=ContractTestComponent, overrides={}, properties={backgroundColor=ComponentProperty(condition=ComponentConditionProperty(operator=eq, field=isLoggedIn, operand=true, else_=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=loggedOutColor, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), then=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=loggedInColor, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), property=buttonUser), userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), disabled=ComponentProperty(condition=ComponentConditionProperty(operator=eq, field=isLoggedIn, operand=true, else_=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=false, model=null, collectionBindingProperties=null, event=null), then=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=true, model=null, collectionBindingProperties=null, event=null), property=buttonUser), userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), labelWidth=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=null, property=width), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), label=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=firstName, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=Spain, type=null, value=null, model=null, collectionBindingProperties=null, event=null)], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), prompt=ComponentProperty(condition=ComponentConditionProperty(operator=gt, field=age, operand=18, else_=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=Sorry you cannot vote, model=null, collectionBindingProperties=null, event=null), then=ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=ComponentPropertyBindingProperties(field=firstname, property=buttonUser), bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), ComponentProperty(condition=null, userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=, cast your vote., model=null, collectionBindingProperties=null, event=null)], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null), property=buttonUser), userAttribute=null, importedValue=null, bindingProperties=null, bindings={}, configured=null, concat=[], defaultValue=null, type=null, value=null, model=null, collectionBindingProperties=null, event=null)}, sourceId=null, tags={}, variants=[])