def setUp(self):
        super(BaseClusterCreateTest, self).setUp()
        self.fixture = fixtures.RancherFixture()
        self.url = factories.ClusterFactory.get_list_url()
        openstack_service_settings = openstack_factories.OpenStackServiceSettingsFactory(
            customer=self.fixture.customer
        )
        self.tenant = openstack_factories.TenantFactory(
            service_settings=openstack_service_settings
        )

        openstack_tenant_factories.FlavorFactory(settings=self.fixture.tenant_settings)
        image = openstack_tenant_factories.ImageFactory(
            settings=self.fixture.tenant_settings
        )
        self.default_security_group = openstack_tenant_factories.SecurityGroupFactory(
            name='default', settings=self.fixture.tenant_settings
        )
        self.fixture.settings.options['base_image_name'] = image.name
        self.fixture.settings.save()

        self.network = openstack_tenant_factories.NetworkFactory(
            settings=self.fixture.tenant_settings
        )
        self.subnet = openstack_tenant_factories.SubNetFactory(
            network=self.network, settings=self.fixture.tenant_settings
        )
        self.flavor = Flavor.objects.get(settings=self.fixture.tenant_settings)
        self.flavor.ram = 1024 * 8
        self.flavor.cores = 2
        self.flavor.save()
        self.fixture.settings.options['base_subnet_name'] = self.subnet.name
        self.fixture.settings.save()
Exemple #2
0
    def setUp(self):
        super(BaseClusterCreateTest, self).setUp()
        self.fixture = fixtures.RancherFixture()
        self.url = factories.ClusterFactory.get_list_url()
        openstack_service_settings = openstack_factories.OpenStackServiceSettingsFactory(
            customer=self.fixture.customer)
        openstack_service = openstack_factories.OpenStackServiceFactory(
            customer=self.fixture.customer,
            settings=openstack_service_settings)
        openstack_spl = openstack_factories.OpenStackServiceProjectLinkFactory(
            project=self.fixture.project, service=openstack_service)
        self.tenant = openstack_factories.TenantFactory(
            service_project_link=openstack_spl)

        settings = ServiceSettings.objects.get(scope=self.tenant)
        project = self.fixture.project
        instance_spl = OpenStackTenantServiceProjectLink.objects.get(
            project=project, service__settings=settings)

        openstack_tenant_factories.FlavorFactory(
            settings=instance_spl.service.settings)
        image = openstack_tenant_factories.ImageFactory(
            settings=instance_spl.service.settings)
        openstack_tenant_factories.SecurityGroupFactory(
            name='default', settings=instance_spl.service.settings)
        self.fixture.settings.options['base_image_name'] = image.name
        self.fixture.settings.save()

        network = openstack_tenant_factories.NetworkFactory(
            settings=instance_spl.service.settings)
        self.subnet = openstack_tenant_factories.SubNetFactory(
            network=network, settings=instance_spl.service.settings)
        self.fixture.settings.options['base_subnet_name'] = self.subnet.name
        self.fixture.settings.save()
Exemple #3
0
 def test_copy_config_drive_from_admin_settings_to_private_settings(self):
     shared_settings = openstack_factories.OpenStackServiceSettingsFactory()
     shared_settings.options['config_drive'] = True
     shared_settings.save()
     tenant = openstack_factories.TenantFactory(
         service_settings=shared_settings)
     private_settings = structure_models.ServiceSettings.objects.get(
         scope=tenant,
         type=apps.OpenStackTenantConfig.service_name,
     )
     self.assertTrue(private_settings.options['config_drive'])
Exemple #4
0
    def test_updating_openstack_tenant_name_should_lead_to_update_of_a_provider_name(
        self,
    ):
        self.service_settings = factories.OpenStackServiceSettingsFactory()
        self.service_settings.scope = self.tenant
        self.service_settings.save()

        self.client.force_authenticate(self.fixture.staff)
        new_name = 'New name'
        self.client.put(self.get_url(), {'name': new_name})
        self.service_settings.refresh_from_db()
        self.assertEqual(self.service_settings.name, new_name)
Exemple #5
0
 def test_copy_tenant_id_from_tenant_to_private_settings(self):
     shared_settings = openstack_factories.OpenStackServiceSettingsFactory()
     tenant = openstack_factories.TenantFactory(
         service_settings=shared_settings, backend_id=None)
     private_settings = structure_models.ServiceSettings.objects.get(
         scope=tenant,
         type=apps.OpenStackTenantConfig.service_name,
     )
     tenant.backend_id = 'VALID_BACKEND_ID'
     tenant.save()
     private_settings.refresh_from_db()
     self.assertTrue(private_settings.options['tenant_id'],
                     tenant.backend_id)