| OLD | NEW |
| (Empty) | |
| 1 # Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved |
| 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: |
| 10 # |
| 11 # The above copyright notice and this permission notice shall be included |
| 12 # in all copies or substantial portions of the Software. |
| 13 # |
| 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |
| 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 20 # IN THE SOFTWARE. |
| 21 # |
| 22 |
| 23 import unittest |
| 24 import time |
| 25 from boto.rds2.layer1 import RDSConnection |
| 26 |
| 27 |
| 28 class TestRDS2Connection(unittest.TestCase): |
| 29 rds = True |
| 30 |
| 31 def setUp(self): |
| 32 self.conn = RDSConnection() |
| 33 self.db_name = "test-db-%s" % str(int(time.time())) |
| 34 |
| 35 def test_connect_rds(self): |
| 36 # Upon release, this did not function correct. Ensure that |
| 37 # args are passed correctly. |
| 38 import boto |
| 39 conn = boto.connect_rds2() |
| 40 |
| 41 def test_integration(self): |
| 42 resp = self.conn.create_db_instance( |
| 43 db_instance_identifier=self.db_name, |
| 44 allocated_storage=5, |
| 45 db_instance_class='db.t1.micro', |
| 46 engine='postgres', |
| 47 master_username='bototestuser', |
| 48 master_user_password='testtestt3st', |
| 49 # Try to limit the impact & test options. |
| 50 multi_az=False, |
| 51 backup_retention_period=0 |
| 52 ) |
| 53 self.addCleanup( |
| 54 self.conn.delete_db_instance, |
| 55 self.db_name, |
| 56 skip_final_snapshot=True |
| 57 ) |
| 58 |
| 59 # Wait for 6 minutes for it to come up. |
| 60 time.sleep(60 * 6) |
| 61 |
| 62 instances = self.conn.describe_db_instances(self.db_name) |
| 63 inst = instances['DescribeDBInstancesResponse']\ |
| 64 ['DescribeDBInstancesResult']['DBInstances'][0] |
| 65 self.assertEqual(inst['DBInstanceStatus'], 'available') |
| 66 self.assertEqual(inst['Engine'], 'postgres') |
| 67 self.assertEqual(inst['AllocatedStorage'], 5) |
| 68 |
| 69 # Try renaming it. |
| 70 resp = self.conn.modify_db_instance( |
| 71 self.db_name, |
| 72 allocated_storage=10, |
| 73 apply_immediately=True |
| 74 ) |
| 75 |
| 76 # Give it a chance to start modifying... |
| 77 time.sleep(60) |
| 78 |
| 79 instances = self.conn.describe_db_instances(self.db_name) |
| 80 inst = instances['DescribeDBInstancesResponse']\ |
| 81 ['DescribeDBInstancesResult']['DBInstances'][0] |
| 82 self.assertEqual(inst['DBInstanceStatus'], 'modifying') |
| 83 self.assertEqual(inst['Engine'], 'postgres') |
| 84 |
| 85 # ...then finish the remainder of 10 minutes for the change. |
| 86 time.sleep(60 * 9) |
| 87 |
| 88 instances = self.conn.describe_db_instances(self.db_name) |
| 89 inst = instances['DescribeDBInstancesResponse']\ |
| 90 ['DescribeDBInstancesResult']['DBInstances'][0] |
| 91 self.assertEqual(inst['DBInstanceStatus'], 'available') |
| 92 self.assertEqual(inst['Engine'], 'postgres') |
| 93 self.assertEqual(inst['AllocatedStorage'], 10) |
| OLD | NEW |