예제 #1
0
    def test_in_use_cluster_ip_fail_gce(self):
        if not self.gce['enabled']:
            self.skipTest("skipping test for GCE")
        service = self.mk_gce_service()
        name = 'vfxtpy-unittest-{}'.format(int(time.time()))

        instances = service.get_instances(self.gce['existing'])
        existing_address = service.ip(instances[0])

        def _should_fail():
            cluster = Cluster.create(
                service,
                self.gce['instance_type'],
                name,
                'PLACEHOLDER',
                address_range_start=existing_address,
                address_range_end=vFXT.Cidr.to_address(
                    vFXT.Cidr.from_address(existing_address) + 1),
                address_range_netmask='255.255.255.255',
                size=1,
                tags=['unittest'],
                metadata={'vfxtpy-unittest': 'auto'})
            # the above should not complete... but if it does
            cluster.destroy(quick_destroy=True)
            raise Exception("test_gce_in_use_cluster_ip_fail did not fail")

        self.assertRaises(vFXT.service.vFXTConfigurationException,
                          _should_fail)
예제 #2
0
    def test_bad_add_node_ip_validation_gce(self):
        if not self.create_clusters:
            self.skipTest("skipping full cluster create tests for GCE")
        if not self.gce['enabled']:
            self.skipTest("skipping test for GCE")
        service = self.mk_gce_service()

        instances = service.get_instances(self.gce['existing'])
        existing_address = service.ip(instances[0])

        name = 'vfxtpy-unittest-{}'.format(int(time.time()))
        cluster = Cluster.create(service,
                                 self.gce['instance_type'],
                                 name,
                                 'PLACEHOLDER',
                                 root_image=self.gce['vfxt_image'],
                                 size=3,
                                 wait_for_state='yellow',
                                 tags=['unittest'],
                                 metadata={'vfxtpy-unittest': 'auto'})
        try:

            def _should_fail_instance_in_use():
                cluster.add_nodes(1, instance_addresses=[existing_address])
                raise Exception("test did not fail")

            self.assertRaises(vFXT.service.vFXTConfigurationException,
                              _should_fail_instance_in_use)

            def _should_fail_not_enough_instance():
                cluster.add_nodes(2, instance_addresses=[existing_address])
                raise Exception("test did not fail")

            self.assertRaises(vFXT.service.vFXTConfigurationException,
                              _should_fail_not_enough_instance)

            def _should_fail_not_enough_cluster():
                cluster.add_nodes(2,
                                  address_range_start=existing_address,
                                  address_range_end=existing_address,
                                  address_range_netmask='255.255.255.255')
                raise Exception("test did not fail")

            self.assertRaises(vFXT.service.vFXTConfigurationException,
                              _should_fail_not_enough_cluster)

            def _should_fail_cluster_in_use():
                cluster.add_nodes(1,
                                  address_range_start=existing_address,
                                  address_range_end=existing_address,
                                  address_range_netmask='255.255.255.255')
                raise Exception("test did not fail")

            self.assertRaises(vFXT.service.vFXTConfigurationException,
                              _should_fail_cluster_in_use)
        finally:
            cluster.destroy(quick_destroy=True)
예제 #3
0
    def test_in_use_mgmt_ip_fail_azure(self):
        if not self.azure['enabled']:
            self.skipTest("skipping test for Azure")
        service = self.mk_azure_service()
        name = 'vfxtpy-unittest-{}'.format(int(time.time()))

        instances = service.get_instances(self.azure['existing'])
        existing_address = service.ip(instances[0])

        def _should_fail():
            cluster = Cluster.create(service,
                                     self.azure['instance_type'],
                                     name,
                                     'PLACEHOLDER',
                                     management_address=existing_address,
                                     tags=['unittest'],
                                     metadata={'vfxtpy-unittest': 'auto'})
            # the above should not complete... but if it does
            cluster.destroy(quick_destroy=True)
            raise Exception("test_azure_in_use_mgmt_ip_fail did not fail")

        self.assertRaises(vFXT.service.vFXTConfigurationException,
                          _should_fail)
예제 #4
0
파일: test_GCE.py 프로젝트: Azure/AvereSDK
 def test_get_instances(self):
     service = self.mk_gce_service()
     instances = service.get_instances(self.gce['existing'])
     self.assertTrue(len(instances) == len(self.gce['existing']),
                     msg="Checking for our basic service instances")