-
Notifications
You must be signed in to change notification settings - Fork 152
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 I count and Then <expectation> does not work as expected #187
Comments
I figured out that a more graceful handling of Not even sure if the count is meant to be used in the way I did. |
Great to hear you loved it! 🎉 Yes, normally it requires a property to be defined, not just the resource itself, but I think this is quite a valid case. I will incorporate this into the tool! Thanks for the issue 🎉 |
Thanks @eerkunt , many thanks for the effort! |
This does not work as expected as after counting as the count function returns a dict. Cannot count set |
Having a look now, sorry couldn't had a look tomorrow was quite hectic. |
1.0.58 will be released in few minutes. Could you please have a try ? |
Hi eerkunt, that works like charm! Thank you for the effort :) |
Description :
Using terraform-compliance version 1.0.57 and loving it!
When I count them
andThen
clauses for the counter do not work as expected, raising:To Reproduce
1.
main.tf:
<Used
terraform-compliance
parameters>terraform plan -out=plan.out && terraform-compliance -f test/bdd/ -p plan.out
python
(file test/bdd/webvpc.features):
Expected behavior :
The scenario should pass. No exception should be raised.
Tested versions :
Additional context
The code does not reflect the test / specs that use a dict {'values': } as the code expects an integer instead of a dict.
The
When I count them
directive creates a{'values': <int>}
dict instead of a plainint
valueand assigns it tostash
in [1]. Counter accessesstash
and then evaluates based on the type, resulting [2] to be banced into instead of [3].Hint:
The
MockedStepContext
object defines aproperty_name
attribute that does not get assigned by default in theGiven
evaluation function ([4]). This lets the according test pass. ([5]).1: https://github.com/eerkunt/terraform-compliance/blob/02be1d2c4c98754f41998ccb2e9557708eac141b/terraform_compliance/steps/steps.py#L397
2: https://github.com/eerkunt/terraform-compliance/blob/02be1d2c4c98754f41998ccb2e9557708eac141b/terraform_compliance/steps/steps.py#L423
3: https://github.com/eerkunt/terraform-compliance/blob/02be1d2c4c98754f41998ccb2e9557708eac141b/terraform_compliance/steps/steps.py#L432
4: https://github.com/eerkunt/terraform-compliance/blob/02be1d2c4c98754f41998ccb2e9557708eac141b/terraform_compliance/steps/steps.py#L44
5: https://github.com/eerkunt/terraform-compliance/blob/02be1d2c4c98754f41998ccb2e9557708eac141b/tests/mocks.py#L269
The text was updated successfully, but these errors were encountered: