Merge pull request #1455 from grahamlyons/snapshot-search-bug
Snapshot search bug
This commit is contained in:
commit
6826b82cfb
@ -345,6 +345,10 @@ class BaseResponse(_TemplateEnvironmentMixin):
|
|||||||
if is_tracked(name) or not name.startswith(param_prefix):
|
if is_tracked(name) or not name.startswith(param_prefix):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if len(name) > len(param_prefix) and \
|
||||||
|
not name[len(param_prefix):].startswith('.'):
|
||||||
|
continue
|
||||||
|
|
||||||
match = self.param_list_regex.search(name[len(param_prefix):]) if len(name) > len(param_prefix) else None
|
match = self.param_list_regex.search(name[len(param_prefix):]) if len(name) > len(param_prefix) else None
|
||||||
if match:
|
if match:
|
||||||
prefix = param_prefix + match.group(1)
|
prefix = param_prefix + match.group(1)
|
||||||
|
@ -5,10 +5,11 @@ from nose.tools import assert_raises
|
|||||||
|
|
||||||
from moto.ec2 import ec2_backends
|
from moto.ec2 import ec2_backends
|
||||||
import boto
|
import boto
|
||||||
|
import boto3
|
||||||
from boto.exception import EC2ResponseError
|
from boto.exception import EC2ResponseError
|
||||||
import sure # noqa
|
import sure # noqa
|
||||||
|
|
||||||
from moto import mock_ec2_deprecated
|
from moto import mock_ec2_deprecated, mock_ec2
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2_deprecated
|
@mock_ec2_deprecated
|
||||||
@ -579,3 +580,25 @@ def test_volume_tag_escaping():
|
|||||||
|
|
||||||
snaps = [snap for snap in conn.get_all_snapshots() if snap.id == snapshot.id]
|
snaps = [snap for snap in conn.get_all_snapshots() if snap.id == snapshot.id]
|
||||||
dict(snaps[0].tags).should.equal({'key': '</closed>'})
|
dict(snaps[0].tags).should.equal({'key': '</closed>'})
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ec2
|
||||||
|
def test_search_for_many_snapshots():
|
||||||
|
ec2_client = boto3.client('ec2', region_name='eu-west-1')
|
||||||
|
|
||||||
|
volume_response = ec2_client.create_volume(
|
||||||
|
AvailabilityZone='eu-west-1a', Size=10
|
||||||
|
)
|
||||||
|
|
||||||
|
snapshot_ids = []
|
||||||
|
for i in range(1, 20):
|
||||||
|
create_snapshot_response = ec2_client.create_snapshot(
|
||||||
|
VolumeId=volume_response['VolumeId']
|
||||||
|
)
|
||||||
|
snapshot_ids.append(create_snapshot_response['SnapshotId'])
|
||||||
|
|
||||||
|
snapshots_response = ec2_client.describe_snapshots(
|
||||||
|
SnapshotIds=snapshot_ids
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(snapshots_response['Snapshots']) == len(snapshot_ids)
|
||||||
|
Loading…
Reference in New Issue
Block a user