コード例 #1
0
def test_positive_end_to_end(session, rhev_data, module_org, module_loc,
                             module_ca_cert, version):
    """Perform end to end testing for compute resource RHEV.

    :id: 3c079675-e5d3-490e-9b7e-1c2950f9965d

    :parametrized: yes

    :expectedresults: All expected CRUD actions finished successfully.

    :CaseLevel: Integration

    :CaseImportance: Critical
    """
    name = gen_string('alpha')
    new_name = gen_string('alpha')
    description = gen_string('alpha')
    with session:
        session.computeresource.create({
            'name':
            name,
            'description':
            description,
            'provider':
            FOREMAN_PROVIDERS['rhev'],
            'provider_content.url':
            rhev_data['rhev_url'],
            'provider_content.user':
            rhev_data['username'],
            'provider_content.password':
            rhev_data['password'],
            'provider_content.api4':
            version,
            'provider_content.datacenter.value':
            rhev_data['datacenter'],
            'provider_content.certification_authorities':
            module_ca_cert,
        })
        resource_values = session.computeresource.read(name)
        assert resource_values['name'] == name
        assert resource_values['description'] == description
        assert resource_values['provider'] == FOREMAN_PROVIDERS['rhev']
        assert resource_values['provider_content']['user'] == rhev_data[
            'username']
        assert resource_values['provider_content']['datacenter'][
            'value'] == rhev_data['datacenter']
        assert resource_values['provider_content']['api4'] == version
        session.computeresource.edit(name, {'name': new_name})
        assert not session.computeresource.search(name)
        assert session.computeresource.search(new_name)[0]['Name'] == new_name
        session.computeresource.delete(new_name)
        assert not entities.AbstractComputeResource().search(
            query={'search': f'name={new_name}'})
コード例 #2
0
    def test_pre_create_gce_cr_and_host(self, arch_os_domain, function_org,
                                        gce_cert):
        """Create GCE Compute Resource

        :id: preupgrade-ef82143d-efef-49b2-9702-93d67ef6804c

        :steps: In Preupgrade Satellite, create GCE Compute Resource

        :expectedresults: The GCE CR created successfully
        """
        arch, os, domain_name = arch_os_domain
        cr_name = gen_string('alpha')
        loc = entities.Location().create()
        with Session('gce_upgrade_tests') as session:
            # Compute Resource Create and Assertions
            session.computeresource.create({
                'name':
                cr_name,
                'provider':
                FOREMAN_PROVIDERS['google'],
                'provider_content.google_project_id':
                gce_cert['project_id'],
                'provider_content.client_email':
                gce_cert['client_email'],
                'provider_content.certificate_path':
                settings.gce.cert_path,
                'provider_content.zone.value':
                settings.gce.zone,
                'organizations.resources.assigned': [function_org.name],
                'locations.resources.assigned': [loc.name],
            })
        gce_cr = entities.AbstractComputeResource().search(
            query={'search': f'name={cr_name}'})[0]
        gce_img = entities.Image(
            architecture=arch,
            compute_resource=gce_cr,
            name='autoupgrade_gce_img',
            operatingsystem=os,
            username='******',
            uuid=LATEST_RHEL7_GCE_IMG_UUID,
        ).create()
        create_dict({
            self.__class__.__name__: {
                'org': function_org.name,
                'loc': loc.name,
                'cr_name': cr_name,
            }
        })
        assert gce_cr.name == cr_name
        assert gce_img.name == 'autoupgrade_gce_img'
コード例 #3
0
 def test_pre_create_gce_cr_and_host(self):
     """
     """
     cr_name = gen_string('alpha')
     org = entities.Organization().create()
     loc = entities.Location().create()
     with Session('gce_upgrade_tests') as session:
         # Compute Resource Create and Assertions
         session.computeresource.create({
             'name':
             cr_name,
             'provider':
             FOREMAN_PROVIDERS['google'],
             'provider_content.google_project_id':
             GCE_SETTINGS['project_id'],
             'provider_content.client_email':
             GCE_SETTINGS['client_email'],
             'provider_content.certificate_path':
             GCE_SETTINGS['cert_path'],
             'provider_content.zone.value':
             GCE_SETTINGS['zone'],
             'organizations.resources.assigned': [org.name],
             'locations.resources.assigned': [loc.name],
         })
     gce_cr = entities.AbstractComputeResource().search(
         query={'search': 'name={}'.format(cr_name)})[0]
     gce_img = entities.Image(
         architecture=self.arch,
         compute_resource=gce_cr,
         name='autoupgrade_gce_img',
         operatingsystem=self.os,
         username='******',
         uuid=LATEST_RHEL7_GCE_IMG_UUID,
     ).create()
     create_dict({
         self.__class__.__name__: {
             'org': org.name,
             'loc': loc.name,
             'cr_name': cr_name
         }
     })
     assert gce_cr.name == cr_name
     assert gce_img.name == 'autoupgrade_gce_img'