File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -319,9 +319,20 @@ def test_schema_no_metrics(service, namespace):
319319 my_metrics .serialize_metric_set ()
320320
321321
322- def test_exceed_number_of_dimensions (metric , namespace , monkeypatch ):
323- # GIVEN we we have more dimensions than CloudWatch supports
324- # and that service dimension is injected like a user-defined dimension (N+1)
322+ def test_exceed_number_of_dimensions (metric , namespace ):
323+ # GIVEN we have more dimensions than CloudWatch supports
324+ dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (11 )]
325+
326+ # WHEN we attempt to serialize them into a valid EMF object
327+ # THEN it should fail validation and raise SchemaValidationError
328+ with pytest .raises (SchemaValidationError , match = "Maximum number of dimensions exceeded.*" ):
329+ with single_metric (** metric , namespace = namespace ) as my_metric :
330+ for dimension in dimensions :
331+ my_metric .add_dimension (** dimension )
332+
333+
334+ def test_exceed_number_of_dimensions_with_service (metric , namespace , monkeypatch ):
335+ # GIVEN we have service set and add more dimensions than CloudWatch supports (N+1)
325336 monkeypatch .setenv ("POWERTOOLS_SERVICE_NAME" , "test_service" )
326337 dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (9 )]
327338
You can’t perform that action at this time.
0 commit comments