Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: third_party/gsutil/boto/tests/autoscale/test_connection.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/gsutil/boto/tests/autoscale/test_connection.py
diff --git a/third_party/gsutil/20110627/boto/tests/autoscale/test_connection.py b/third_party/gsutil/boto/tests/autoscale/test_connection.py
similarity index 61%
rename from third_party/gsutil/20110627/boto/tests/autoscale/test_connection.py
rename to third_party/gsutil/boto/tests/autoscale/test_connection.py
index 921fe435f055d159ab7a00b878d569aa8373753b..a650dcef188c7edaef0a3bf86cca997b1a37686f 100644
--- a/third_party/gsutil/20110627/boto/tests/autoscale/test_connection.py
+++ b/third_party/gsutil/boto/tests/autoscale/test_connection.py
@@ -33,6 +33,7 @@ from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.policy import AdjustmentType, MetricCollectionTypes, ScalingPolicy
from boto.ec2.autoscale.scheduled import ScheduledUpdateGroupAction
from boto.ec2.autoscale.instance import Instance
+from boto.ec2.autoscale.tag import Tag
class AutoscaleConnectionTest(unittest.TestCase):
@@ -91,5 +92,75 @@ class AutoscaleConnectionTest(unittest.TestCase):
types = c.get_all_metric_collection_types()
self.assertTrue(type(types), MetricCollectionTypes)
+ # create the simplest possible AutoScale group
+ # first create the launch configuration
+ time_string = '%d' % int(time.time())
+ lc_name = 'lc-%s' % time_string
+ lc = LaunchConfiguration(name=lc_name, image_id='ami-2272864b',
+ instance_type='t1.micro')
+ c.create_launch_configuration(lc)
+ found = False
+ lcs = c.get_all_launch_configurations()
+ for lc in lcs:
+ if lc.name == lc_name:
+ found = True
+ break
+ assert found
+
+ # now create autoscaling group
+ group_name = 'group-%s' % time_string
+ group = AutoScalingGroup(name=group_name, launch_config=lc,
+ availability_zones=['us-east-1a'],
+ min_size=1, max_size=1)
+ c.create_auto_scaling_group(group)
+ found = False
+ groups = c.get_all_groups()
+ for group in groups:
+ if group.name == group_name:
+ found = True
+ break
+ assert found
+
+ # now create a tag
+ tag = Tag(key='foo', value='bar', resource_id=group_name,
+ propagate_at_launch=True)
+ c.create_or_update_tags([tag])
+
+ found = False
+ tags = c.get_all_tags()
+ for tag in tags:
+ if tag.resource_id == group_name and tag.key == 'foo':
+ found = True
+ break
+ assert found
+
+ c.delete_tags([tag])
+
+ # shutdown instances and wait for them to disappear
+ group.shutdown_instances()
+ instances = True
+ while instances:
+ time.sleep(5)
+ groups = c.get_all_groups()
+ for group in groups:
+ if group.name == group_name:
+ if not group.instances:
+ instances = False
+
+ group.delete()
+ lc.delete()
+
+ found = True
+ while found:
+ found = False
+ time.sleep(5)
+ tags = c.get_all_tags()
+ for tag in tags:
+ if tag.resource_id == group_name and tag.key == 'foo':
+ found = True
+
+ assert not found
+
print '--- tests completed ---'
+
« no previous file with comments | « third_party/gsutil/boto/tests/autoscale/__init__.py ('k') | third_party/gsutil/boto/tests/cloudfront/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698