Skip to content

Commit dd2b503

Browse files
ci(boto): remove test_kinesis_put_records_base64_exceeds_max_size (#4185) (#4209)
## 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]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 2f7ee42 commit dd2b503

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
@@ -1653,56 +1653,6 @@ def test_kinesis_put_records_base64_trace_injection(self):
16531653

16541654
client.delete_stream(StreamName=stream_name)
16551655

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

0 commit comments

Comments
 (0)