parent
cb53f86c24
commit
a48c811069
4 changed files with 109 additions and 3 deletions
|
|
@ -2,10 +2,13 @@ from __future__ import unicode_literals
|
|||
|
||||
import datetime
|
||||
import time
|
||||
import pytest
|
||||
|
||||
import boto.kinesis
|
||||
import boto3
|
||||
from boto.kinesis.exceptions import ResourceNotFoundException, InvalidArgumentException
|
||||
from botocore.exceptions import ClientError
|
||||
|
||||
from dateutil.tz import tzlocal
|
||||
|
||||
from moto import mock_kinesis, mock_kinesis_deprecated
|
||||
|
|
@ -479,6 +482,71 @@ def test_get_records_from_empty_stream_at_timestamp():
|
|||
response["MillisBehindLatest"].should.equal(0)
|
||||
|
||||
|
||||
@mock_kinesis
|
||||
def test_valid_increase_stream_retention_period():
|
||||
conn = boto3.client("kinesis", region_name="us-west-2")
|
||||
stream_name = "my_stream"
|
||||
conn.create_stream(StreamName=stream_name, ShardCount=1)
|
||||
|
||||
conn.increase_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=40
|
||||
)
|
||||
|
||||
response = conn.describe_stream(StreamName=stream_name)
|
||||
response["StreamDescription"]["RetentionPeriodHours"].should.equal(40)
|
||||
|
||||
|
||||
@mock_kinesis
|
||||
def test_invalid_increase_stream_retention_period():
|
||||
conn = boto3.client("kinesis", region_name="us-west-2")
|
||||
stream_name = "my_stream"
|
||||
conn.create_stream(StreamName=stream_name, ShardCount=1)
|
||||
|
||||
conn.increase_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=30
|
||||
)
|
||||
with pytest.raises(ClientError) as ex:
|
||||
conn.increase_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=20
|
||||
)
|
||||
ex.value.response["Error"]["Code"].should.equal("InvalidArgumentException")
|
||||
ex.value.response["Error"]["Message"].should.equal(20)
|
||||
|
||||
|
||||
@mock_kinesis
|
||||
def test_valid_decrease_stream_retention_period():
|
||||
conn = boto3.client("kinesis", region_name="us-west-2")
|
||||
stream_name = "decrease_stream"
|
||||
conn.create_stream(StreamName=stream_name, ShardCount=1)
|
||||
|
||||
conn.increase_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=30
|
||||
)
|
||||
conn.decrease_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=25
|
||||
)
|
||||
|
||||
response = conn.describe_stream(StreamName=stream_name)
|
||||
response["StreamDescription"]["RetentionPeriodHours"].should.equal(25)
|
||||
|
||||
|
||||
@mock_kinesis
|
||||
def test_invalid_decrease_stream_retention_period():
|
||||
conn = boto3.client("kinesis", region_name="us-west-2")
|
||||
stream_name = "decrease_stream"
|
||||
conn.create_stream(StreamName=stream_name, ShardCount=1)
|
||||
|
||||
conn.increase_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=30
|
||||
)
|
||||
with pytest.raises(ClientError) as ex:
|
||||
conn.decrease_stream_retention_period(
|
||||
StreamName=stream_name, RetentionPeriodHours=20
|
||||
)
|
||||
ex.value.response["Error"]["Code"].should.equal("InvalidArgumentException")
|
||||
ex.value.response["Error"]["Message"].should.equal(20)
|
||||
|
||||
|
||||
@mock_kinesis_deprecated
|
||||
def test_invalid_shard_iterator_type():
|
||||
conn = boto.kinesis.connect_to_region("us-west-2")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue