Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using OOTB CFN Test is broken with 'Tags' attribute on generated class #248

Open
carpnick opened this issue Jan 17, 2023 · 0 comments

Comments

@carpnick
Copy link

Assuming same steps in #247, using the workaround to get by the current cryptography issue.

After trying to run one test cfn test -- -k contract_create_delete, it fails with:

Traceback (most recent call last):
  File "/var/task/cloudformation_cli_python_lib/resource.py", line 165, in _cast_resource_request
    return UnmodelledRequest(
  File "/var/task/cloudformation_cli_python_lib/utils.py", line 156, in to_modelled
    desiredResourceState=model_cls._deserialize(self.desiredResourceState),
  File "/var/task/dd_dd_dd/models.py", line 74, in _deserialize
    Tags=set_or_none(json_data.get("Tags")),
  File "/var/task/dd_dd_dd/models.py", line 30, in set_or_none
    return set(value)
TypeError: unhashable type: 'dict'

Root cause and fix:

  • The default JSON makes Tags a list/array of Tag object ("#/definitions/Tag"). A tag object then has a key and value attribute. This is not hashable
  • Fix(probably) change this line to a frozen set: return frozenset(value)
    • Also same change for hooks?
    • Maybe this one too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant