def test_action_shouldnt_be_run_while_hostprovider_has_an_issue(client): with allure.step('Create default hostprovider and get id'): bundle = utils.get_data_dir(__file__, "provider") steps.upload_bundle(client, bundle) provider_id = steps.create_hostprovider(client)['id'] with allure.step(f'Run action with error for provider {provider_id}'): with pytest.raises(coreapi.exceptions.ErrorMessage) as e: client.provider.action.run.create( provider_id=provider_id, action_id=client.provider.action.list(provider_id=provider_id)[0]['id']) with allure.step('Check if provider action has issues'): TASK_ERROR.equal(e, 'action has issues')
def test_provider_shouldnt_be_deleted_when_it_has_host(client): steps.upload_bundle(client, BUNDLES + 'hostprovider_bundle') with allure.step('Create provider'): provider = steps.create_hostprovider(client) with allure.step('Create host'): client.host.create(prototype_id=client.stack.host.list()[0]['id'], provider_id=provider['id'], fqdn=utils.random_string()) with allure.step('Delete provider'): with pytest.raises(exceptions.ErrorMessage) as e: client.provider.delete(provider_id=provider['id']) with allure.step('Check error'): errorcodes.PROVIDER_CONFLICT.equal(e, 'There is host ', ' of host provider ')
def test_when_hostprovider_has_issue_than_upgrade_locked(client): with allure.step('Create hostprovider'): bundledir = utils.get_data_dir(__file__, "provider") upgrade_bundle = utils.get_data_dir(__file__, "upgrade", "provider") steps.upload_bundle(client, bundledir) provider_id = steps.create_hostprovider(client)['id'] steps.upload_bundle(client, upgrade_bundle) with allure.step('Upgrade provider'): with pytest.raises(coreapi.exceptions.ErrorMessage) as e: client.provider.upgrade.do.create( provider_id=provider_id, upgrade_id=client.provider.upgrade.list(provider_id=provider_id)[0]['id']) with allure.step('Check if upgrade locked'): UPGRADE_ERROR.equal(e)
def test_action_shouldnt_be_run_while_host_has_an_issue(client): with allure.step('Create default host and get id'): bundle = utils.get_data_dir(__file__, "host") steps.upload_bundle(client, bundle) provider_id = steps.create_hostprovider(client)['id'] host_id = client.host.create(prototype_id=client.stack.host.list()[0]['id'], provider_id=provider_id, fqdn=utils.random_string())['id'] with allure.step(f'Run action with error for host {host_id}'): with pytest.raises(coreapi.exceptions.ErrorMessage) as e: client.host.action.run.create( host_id=host_id, action_id=client.host.action.list(host_id=host_id)[0]['id']) with allure.step('Check if host action has issues'): TASK_ERROR.equal(e, 'action has issues')
def create_provider(self): return steps.create_hostprovider(self._client)['name']
def hostprovider(client): steps.upload_bundle(client, utils.get_data_dir(__file__, 'host_bundle_on_any_level')) return steps.create_hostprovider(client)