Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for EC2.Waiter.InstanceExists raising JMESPathTypeError #907

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions botocore/data/ec2/2015-10-01/waiters-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
"operation": "DescribeInstances",
"acceptors": [
{
"matcher": "path",
"expected": true,
"argument": "length(Reservations[]) > `0`",
"matcher": "status",
"expected": 200,
"state": "success"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was added because it's possible to get an empty reservations list even if you specify an instance id in some cases. I think we'll just need to modify the waiter code to handle this case appropriately.

},
{
Expand Down
16 changes: 15 additions & 1 deletion tests/integration/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from nose.plugins.attrib import attr

import botocore.session
from botocore.exceptions import ClientError
from botocore.exceptions import ClientError, WaiterError


class TestEC2(unittest.TestCase):
Expand All @@ -38,6 +38,20 @@ def test_get_console_output_handles_error(self):
self.client.get_console_output(InstanceId='i-12345')


class TestEC2Waiter(unittest.TestCase):
def setUp(self):
self.session = botocore.session.get_session()
self.client = self.session.create_client(
'ec2', region_name='us-west-2')

def test_instance_wait_error(self):
"""Test that InstanceExists can handle a nonexistent instance."""
waiter = self.client.get_waiter('instance_exists')
waiter.config.max_attempts = 1
with self.assertRaises(WaiterError):
waiter.wait(InstanceIds=['i-12345'])


class TestEC2Pagination(unittest.TestCase):
def setUp(self):
self.session = botocore.session.get_session()
Expand Down