Exemplo n.º 1
0
    def test_register_instances_valid_id_string(self):
        '''
        tests that given a string containing a instance id and valid ELB that
        register_instances adds the given instance to an ELB
        '''
        conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
        conn_elb = boto.ec2.elb.connect_to_region(region,
                                                  **boto_conn_parameters)
        zones = [zone.name for zone in conn_ec2.get_all_zones()]
        elb_name = 'TestRegisterInstancesValidIdResult'
        conn_elb.create_load_balancer(elb_name, zones, [(80, 80, 'http')])
        reservations = conn_ec2.run_instances('ami-08389d60')
        boto_elb.register_instances(elb_name, reservations.instances[0].id,
                                    **conn_parameters)
        load_balancer_refreshed = conn_elb.get_all_load_balancers(elb_name)[0]
        registered_instance_ids = [instance.id for instance in
                                   load_balancer_refreshed.instances]

        log.debug(load_balancer_refreshed.instances)
        self.assertEqual([reservations.instances[0].id], registered_instance_ids)
Exemplo n.º 2
0
    def test_register_instances_valid_id_string(self):
        '''
        tests that given a string containing a instance id and valid ELB that
        register_instances adds the given instance to an ELB
        '''
        conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
        conn_elb = boto.ec2.elb.connect_to_region(region,
                                                  **boto_conn_parameters)
        zones = [zone.name for zone in conn_ec2.get_all_zones()]
        elb_name = 'TestRegisterInstancesValidIdResult'
        conn_elb.create_load_balancer(elb_name, zones, [(80, 80, 'http')])
        reservations = conn_ec2.run_instances('ami-08389d60')
        boto_elb.register_instances(elb_name, reservations.instances[0].id,
                                    **conn_parameters)
        load_balancer_refreshed = conn_elb.get_all_load_balancers(elb_name)[0]
        registered_instance_ids = [instance.id for instance in
                                   load_balancer_refreshed.instances]

        log.debug(load_balancer_refreshed.instances)
        self.assertEqual([reservations.instances[0].id], registered_instance_ids)
Exemplo n.º 3
0
 def test_register_instances_valid_id_result_true(self):
     '''
     tests that given a valid instance id and valid ELB that
     register_instances returns True.
     '''
     conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
     conn_elb = boto.ec2.elb.connect_to_region(region,
                                               **boto_conn_parameters)
     zones = [zone.name for zone in conn_ec2.get_all_zones()]
     elb_name = 'TestRegisterInstancesValidIdResult'
     conn_elb.create_load_balancer(elb_name, zones, [(80, 80, 'http')])
     reservations = conn_ec2.run_instances('ami-08389d60')
     register_result = boto_elb.register_instances(
         elb_name, reservations.instances[0].id, **conn_parameters)
     self.assertEqual(True, register_result)
Exemplo n.º 4
0
 def test_register_instances_valid_id_result_true(self):
     """
     tests that given a valid instance id and valid ELB that
     register_instances returns True.
     """
     conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
     conn_elb = boto.ec2.elb.connect_to_region(region,
                                               **boto_conn_parameters)
     zones = [zone.name for zone in conn_ec2.get_all_zones()]
     elb_name = "TestRegisterInstancesValidIdResult"
     conn_elb.create_load_balancer(elb_name, zones, [(80, 80, "http")])
     reservations = conn_ec2.run_instances("ami-08389d60")
     register_result = boto_elb.register_instances(
         elb_name, reservations.instances[0].id, **conn_parameters)
     assert True == register_result
Exemplo n.º 5
0
 def test_register_instances_valid_id_result_true(self):
     '''
     tests that given a valid instance id and valid ELB that
     register_instances returns True.
     '''
     conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
     conn_elb = boto.ec2.elb.connect_to_region(region,
                                               **boto_conn_parameters)
     zones = [zone.name for zone in conn_ec2.get_all_zones()]
     elb_name = 'TestRegisterInstancesValidIdResult'
     conn_elb.create_load_balancer(elb_name, zones, [(80, 80, 'http')])
     reservations = conn_ec2.run_instances('ami-08389d60')
     register_result = boto_elb.register_instances(elb_name,
                                                   reservations.instances[0].id,
                                                   **conn_parameters)
     self.assertEqual(True, register_result)