Ejemplo n.º 1
0
def test_uninstall_from_source(test_plugins, file_server):
    with _patch_client([]):
        installer.install(
            plugins.plugin_struct(file_server, source='mock-plugin.tar'))
    _assert_task_runnable('mock_plugin.tasks.run', expected_return='run')
    with _patch_client([]):
        installer.uninstall(plugin=plugins.plugin_struct(file_server))
        _assert_task_not_runnable('mock_plugin.tasks.run')
Ejemplo n.º 2
0
def test_uninstall_from_source_with_deployment_id(test_plugins, file_server):
    deployment_id = 'deployment'
    with _patch_client([]):
        installer.install(plugins.plugin_struct(file_server,
                                                source='mock-plugin.tar'),
                          deployment_id=deployment_id)
        _assert_task_not_runnable('mock_plugin.tasks.run')
    _assert_task_runnable('mock_plugin.tasks.run',
                          expected_return='run',
                          deployment_id=deployment_id)
    with _patch_client([]):
        installer.uninstall(plugin=plugins.plugin_struct(file_server),
                            deployment_id=deployment_id)
        _assert_task_not_runnable('mock_plugin.tasks.run',
                                  deployment_id=deployment_id)
Ejemplo n.º 3
0
def test_install_from_source(test_plugins, file_server):
    with _patch_client([]):
        installer.install(
            plugins.plugin_struct(file_server, source='mock-plugin.tar'))
    _assert_task_runnable('mock_plugin.tasks.run', expected_return='run')
    _assert_task_runnable('mock_plugin.tasks.call_entry_point',
                          expected_return='mock-plugin-entry-point')
Ejemplo n.º 4
0
def test_install_from_wagon(test_plugins, file_server):
    with _patch_for_install_wagon(
            plugins.PACKAGE_NAME,
            plugins.PACKAGE_VERSION,
            download_path=test_plugins[plugins.PACKAGE_NAME],
    ):
        installer.install(plugins.plugin_struct(file_server))
    _assert_wagon_plugin_installed()
Ejemplo n.º 5
0
def test_install_from_source_with_requirements(test_plugins, file_server):
    with _patch_client([]):
        installer.install(
            plugins.plugin_struct(file_server,
                                  source='mock-plugin-with-requirements.tar',
                                  args='-r requirements.txt'))
    _assert_task_runnable(
        'mock_with_install_args_for_test.module.do_stuff',
        expected_return='on the brilliant marble-sanded beaches of '
        'Santraginus V')
Ejemplo n.º 6
0
def test_install_from_wagon_overriding_same_version(test_plugins, file_server):
    test_install_from_wagon(test_plugins, file_server)
    with _patch_for_install_wagon(
            plugins.PACKAGE_NAME,
            plugins.PACKAGE_VERSION,
            download_path=test_plugins['mock-plugin-modified'],
            plugin_id='2'):
        with pytest.raises(exceptions.PluginInstallationError,
                           match='.*does not match the ID.*'):
            installer.install(plugins.plugin_struct(file_server))
Ejemplo n.º 7
0
def test_install_no_source_or_managed_plugin(file_server):
    with _patch_client([]):
        with pytest.raises(cloudify_exceptions.NonRecoverableError,
                           match='.*source or managed.*'):
            installer.install(plugins.plugin_struct(file_server))
Ejemplo n.º 8
0
 def installer_func(dep_id='__system__'):
     with current_ctx.push(ctx_obj):
         installer.install(plugins.plugin_struct(file_server), dep_id)