Skip to content

Commit d7864be

Browse files
ci(boto): remove test_kinesis_put_records_base64_exceeds_max_size (#4185) (#4211)
## Description With the latest [moto release](getmoto/moto#5249), adding a record which exceeds the max size constraint is not supported. Since this test validates unsupported behavior it was removed. New [Boto Validation Error](https://app.circleci.com/pipelines/github/DataDog/dd-trace-py/21184/workflows/33375cfd-6f3f-446e-aae7-2e800994e9df/jobs/1440546): ``` def test_kinesis_put_records_base64_exceeds_max_size(self): client = self.session.create_client("kinesis", region_name="us-east-1") stream_name = "test" client.create_stream(StreamName=stream_name, ShardCount=1) stream = client.describe_stream(StreamName=stream_name)["StreamDescription"] shard_id = stream["Shards"][0]["ShardId"] partition_key = "1234" sample_string = json.dumps({"Hello": "x" * (1 << 20)}) sample_string_bytes = sample_string.encode("ascii") base64_bytes = base64.b64encode(sample_string_bytes) data_str = base64_bytes.decode("ascii") data = [ {"Data": data_str, "PartitionKey": partition_key}, {"Data": data_str, "PartitionKey": partition_key}, ] Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(client) > client.put_records(StreamName=stream_name, Records=data) tests/contrib/botocore/test.py:1676: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ if http.status_code >= 300: error_code = parsed_response.get("Error", {}).get("Code") error_class = self.exceptions.from_code(error_code) > raise error_class(parsed_response, operation_name) E botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the PutRecords operation: 1 validation error detected: Value at 'records.1.member.data' failed to satisfy constraint: Member must have length less than or equal to 1048576 .riot/venv_py3615_moto[all]/lib/python3.6/site-packages/botocore/client.py:911: ValidationException ``` ## Checklist - [ ] Title must conform to [conventional commit](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional). - [ ] Add additional sections for `feat` and `fix` pull requests. - [ ] Ensure tests are passing for affected code. - [ ] [Library documentation](https://github.com/DataDog/dd-trace-py/tree/1.x/docs) and/or [Datadog's documentation site](https://github.com/DataDog/documentation/) is updated. Link to doc PR in description. ## Motivation ## Design ## Testing strategy ## Relevant issue(s) ## Testing strategy ## Reviewer Checklist - [ ] Title is accurate. - [ ] Description motivates each change. - [ ] No unnecessary changes were introduced in this PR. - [ ] PR cannot be broken up into smaller PRs. - [ ] Avoid breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Release note has been added for fixes and features, or else `changelog/no-changelog` label added. - [ ] All relevant GitHub issues are correctly linked. - [ ] Backports are identified and tagged with Mergifyio. - [ ] Add to milestone. (cherry picked from commit 4f8ec5a) Co-authored-by: Munir Abdinur <[email protected]>
1 parent 0868579 commit d7864be

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

tests/contrib/botocore/test.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,56 +1652,6 @@ def test_kinesis_put_records_base64_trace_injection(self):
16521652

16531653
client.delete_stream(StreamName=stream_name)
16541654

1655-
@mock_kinesis
1656-
def test_kinesis_put_records_base64_exceeds_max_size(self):
1657-
client = self.session.create_client("kinesis", region_name="us-east-1")
1658-
1659-
stream_name = "test"
1660-
client.create_stream(StreamName=stream_name, ShardCount=1)
1661-
stream = client.describe_stream(StreamName=stream_name)["StreamDescription"]
1662-
shard_id = stream["Shards"][0]["ShardId"]
1663-
1664-
partition_key = "1234"
1665-
sample_string = json.dumps({"Hello": "x" * (1 << 20)})
1666-
sample_string_bytes = sample_string.encode("ascii")
1667-
base64_bytes = base64.b64encode(sample_string_bytes)
1668-
data_str = base64_bytes.decode("ascii")
1669-
data = [
1670-
{"Data": data_str, "PartitionKey": partition_key},
1671-
{"Data": data_str, "PartitionKey": partition_key},
1672-
]
1673-
1674-
Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(client)
1675-
client.put_records(StreamName=stream_name, Records=data)
1676-
1677-
# check if the appropriate span was generated
1678-
spans = self.get_spans()
1679-
assert spans
1680-
span = spans[0]
1681-
assert len(spans) == 1
1682-
assert span.get_tag("aws.region") == "us-east-1"
1683-
assert span.get_tag("aws.operation") == "PutRecords"
1684-
assert span.get_tag("params.MessageBody") is None
1685-
assert_is_measured(span)
1686-
assert_span_http_status_code(span, 200)
1687-
assert span.service == "test-botocore-tracing.kinesis"
1688-
assert span.resource == "kinesis.putrecords"
1689-
records = span.get_tag("params.Records")
1690-
assert records is None
1691-
1692-
resp = client.get_shard_iterator(StreamName=stream_name, ShardId=shard_id, ShardIteratorType="TRIM_HORIZON")
1693-
shard_iterator = resp["ShardIterator"]
1694-
1695-
# ensure headers are not present in received message
1696-
resp = client.get_records(ShardIterator=shard_iterator)
1697-
assert len(resp["Records"]) == 2
1698-
records = resp["Records"]
1699-
for record in records:
1700-
headers = json.loads(base64.b64decode(record["Data"]).decode("ascii"))
1701-
assert "_datadog" not in headers
1702-
1703-
client.delete_stream(StreamName=stream_name)
1704-
17051655
@unittest.skipIf(PY2, "Skipping for Python 2.7 since older moto doesn't support secretsmanager")
17061656
def test_secretsmanager(self):
17071657
from moto import mock_secretsmanager

0 commit comments

Comments
 (0)