cloud-radar 0.13.3a16__tar.gz → 0.14.0a0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/PKG-INFO +19 -1
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/README.md +18 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/pyproject.toml +1 -1
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/functions.py +12 -1
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/LICENSE.txt +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/__init__.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/__init__.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/e2e/__init__.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/e2e/_stack.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/__init__.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_condition.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_hooks.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_output.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_parameter.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_resource.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_stack.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/_template.py +0 -0
- {cloud_radar-0.13.3a16 → cloud_radar-0.14.0a0}/src/cloud_radar/cf/unit/test__template.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cloud-radar
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.14.0a0
|
4
4
|
Summary: Run functional tests on cloudformation stacks.
|
5
5
|
Home-page: https://github.com/DontShaveTheYak/cloud-radar
|
6
6
|
License: Apache-2.0
|
@@ -242,6 +242,24 @@ dynamic_references = {
|
|
242
242
|
template = Template(template_content, dynamic_references=dynamic_references)
|
243
243
|
```
|
244
244
|
|
245
|
+
There are cases where the default behaviour of our `GetAtt` implementation may not be sufficient and you need a more accurate returned value. When unit testing there are no real AWS resources created, and cloud-radar does not attempt to realistically generate attribute values - a string is always returned. This works good enough most of the time, but there are some cases where if you are attempting to apply intrinsic functions against the attribute value it needs to be more correct. When this occurs, you can add Metadata to the template to provide test values to use.
|
246
|
+
|
247
|
+
```
|
248
|
+
Resources:
|
249
|
+
MediaPackageV2Channel:
|
250
|
+
Type: AWS::MediaPackageV2::Channel
|
251
|
+
Metadata:
|
252
|
+
Cloud-Radar:
|
253
|
+
attribute-values:
|
254
|
+
# Default behaviour of a string is not good enough here, the attribute value is expected to be a List.
|
255
|
+
IngestEndpointUrls:
|
256
|
+
- http://one.example.com
|
257
|
+
- http://two.example.com
|
258
|
+
Properties:
|
259
|
+
ChannelGroupName: dev_video_1
|
260
|
+
ChannelName: !Sub ${AWS::StackName}-MediaPackageChannel
|
261
|
+
```
|
262
|
+
|
245
263
|
A real unit testing example using Pytest can be seen [here](./tests/test_cf/test_examples/test_unit.py)
|
246
264
|
|
247
265
|
</details>
|
@@ -211,6 +211,24 @@ dynamic_references = {
|
|
211
211
|
template = Template(template_content, dynamic_references=dynamic_references)
|
212
212
|
```
|
213
213
|
|
214
|
+
There are cases where the default behaviour of our `GetAtt` implementation may not be sufficient and you need a more accurate returned value. When unit testing there are no real AWS resources created, and cloud-radar does not attempt to realistically generate attribute values - a string is always returned. This works good enough most of the time, but there are some cases where if you are attempting to apply intrinsic functions against the attribute value it needs to be more correct. When this occurs, you can add Metadata to the template to provide test values to use.
|
215
|
+
|
216
|
+
```
|
217
|
+
Resources:
|
218
|
+
MediaPackageV2Channel:
|
219
|
+
Type: AWS::MediaPackageV2::Channel
|
220
|
+
Metadata:
|
221
|
+
Cloud-Radar:
|
222
|
+
attribute-values:
|
223
|
+
# Default behaviour of a string is not good enough here, the attribute value is expected to be a List.
|
224
|
+
IngestEndpointUrls:
|
225
|
+
- http://one.example.com
|
226
|
+
- http://two.example.com
|
227
|
+
Properties:
|
228
|
+
ChannelGroupName: dev_video_1
|
229
|
+
ChannelName: !Sub ${AWS::StackName}-MediaPackageChannel
|
230
|
+
```
|
231
|
+
|
214
232
|
A real unit testing example using Pytest can be seen [here](./tests/test_cf/test_examples/test_unit.py)
|
215
233
|
|
216
234
|
</details>
|
@@ -455,7 +455,18 @@ def get_att(template: "Template", values: Any) -> str:
|
|
455
455
|
if resource_name not in template.template["Resources"]:
|
456
456
|
raise KeyError(f"Fn::GetAtt - Resource {resource_name} not found in template.")
|
457
457
|
|
458
|
-
|
458
|
+
# Get the resource definition
|
459
|
+
resource = template.template["Resources"][resource_name]
|
460
|
+
|
461
|
+
# Check if there is a value in the resource Metadata for this attribute.
|
462
|
+
# If the attribute requested is in the metadata, return it.
|
463
|
+
# Otherwise use the string value of "{resource_name}.{att_name}"
|
464
|
+
|
465
|
+
metadata = resource.get("Metadata", {})
|
466
|
+
cloud_radar_metadata = metadata.get("Cloud-Radar", {})
|
467
|
+
attribute_values = cloud_radar_metadata.get("attribute-values", {})
|
468
|
+
|
469
|
+
return attribute_values.get(att_name, f"{resource_name}.{att_name}")
|
459
470
|
|
460
471
|
|
461
472
|
def get_azs(_t: "Template", region: Any) -> List[str]:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|