aws-cloudformation / aws-cloudformation/cloudformation-cli

Contract test failing when it should succeed

Offen
#856 0 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
337
Forks
172
Ø Merge
3 T. 5 Min.
Gemergte PRs (30 T.)
3

Beschreibung

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](https://github.com/aws-cloudformation/cloudformation-cli/files/7794622/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](https://github.com/aws-cloudformation/cloudformation-cli/files/7794607/contract-test-output.txt)
[sam-lambda-output.txt](https://github.com/aws-cloudformation/cloudformation-cli/files/7794608/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=[])
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, handler_create_delete mit inputs_1_create.json.zip gegen den verlinkten aws-amplifyuibuilder-component-Provider zu reproduzieren. Vergleiche den Fehler in contract-test-output.txt mit der CREATE-Anfrage und dem zurückgegebenen ResourceModel und verwende sam-lambda-output.txt für das Verhalten des Providers. Erledigt ist es, wenn der Contract-Test die erfolgreichen CREATE- und DELETE-Antworten akzeptiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, python
Bereich
testing-qa
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.