示例#1
0
def test_plugin_install_and_uninstall(default_populated_index: None) -> None:
    plugins = "analysis-icu"

    sdk_service.update_configuration(
        config.PACKAGE_NAME,
        foldered_name,
        {"elasticsearch": {
            "plugins": plugins
        }},
        current_expected_task_count,
    )

    config.check_elasticsearch_plugin_installed(plugins,
                                                service_name=foldered_name)

    sdk_service.update_configuration(
        config.PACKAGE_NAME,
        foldered_name,
        {"elasticsearch": {
            "plugins": ""
        }},
        current_expected_task_count,
    )

    config.check_elasticsearch_plugin_uninstalled(plugins,
                                                  service_name=foldered_name)
示例#2
0
def test_plugin_install_and_uninstall(default_populated_index):
    plugin_name = 'analysis-phonetic'
    config.update_app(foldered_name, {'TASKCFG_ALL_ELASTICSEARCH_PLUGINS': plugin_name}, current_expected_task_count)
    config.check_elasticsearch_plugin_installed(plugin_name, service_name=foldered_name)

    config.update_app(foldered_name, {'TASKCFG_ALL_ELASTICSEARCH_PLUGINS': ''}, current_expected_task_count)
    config.check_elasticsearch_plugin_uninstalled(plugin_name, service_name=foldered_name)
    sdk_plan.wait_for_completed_deployment(foldered_name)
    sdk_plan.wait_for_completed_recovery(foldered_name)
示例#3
0
def test_pod_replace_then_immediate_config_update():
    plugin_name = 'analysis-phonetic'

    cfg = sdk_marathon.get_config(foldered_name)
    cfg['env']['TASKCFG_ALL_ELASTICSEARCH_PLUGINS'] = plugin_name
    cfg['env']['UPDATE_STRATEGY'] = 'parallel'

    sdk_cmd.svc_cli(config.PACKAGE_NAME, foldered_name, 'pod replace data-0')

    # issue config update immediately
    sdk_marathon.update_app(foldered_name, cfg)

    # ensure all nodes, especially data-0, get launched with the updated config
    config.check_elasticsearch_plugin_installed(plugin_name, service_name=foldered_name)
    sdk_plan.wait_for_completed_deployment(foldered_name)
    sdk_plan.wait_for_completed_recovery(foldered_name)
示例#4
0
def test_pod_replace_then_immediate_config_update() -> None:
    sdk_cmd.svc_cli(package_name, service_name, "pod replace data-0")

    plugins = "analysis-phonetic"

    sdk_service.update_configuration(
        package_name,
        service_name,
        {"service": {"update_strategy": "parallel"}, "elasticsearch": {"plugins": plugins}},
        current_expected_task_count,
    )

    # Ensure all nodes, especially data-0, get launched with the updated config.
    config.check_elasticsearch_plugin_installed(plugins, service_name=service_name)
    sdk_plan.wait_for_completed_deployment(service_name)
    sdk_plan.wait_for_completed_recovery(service_name)
示例#5
0
def test_pod_replace_then_immediate_config_update():
    sdk_cmd.svc_cli(config.PACKAGE_NAME, foldered_name, "pod replace data-0")

    plugins = "analysis-phonetic"

    sdk_service.update_configuration(
        config.PACKAGE_NAME,
        foldered_name,
        {"service": {"update_strategy": "parallel"}, "elasticsearch": {"plugins": plugins}},
        current_expected_task_count,
    )

    # Ensure all nodes, especially data-0, get launched with the updated config.
    config.check_elasticsearch_plugin_installed(plugins, service_name=foldered_name)
    sdk_plan.wait_for_completed_deployment(foldered_name)
    sdk_plan.wait_for_completed_recovery(foldered_name)
示例#6
0
def test_plugin_install_via_proxy() -> None:
    try:
        _uninstall_and_kill_proxy_before_install()

        proxy_host = sdk_cmd._internal_leader_host()
        proxy_port = 8899
        _install_and_run_proxy(proxy_host, proxy_port)

        plugin_name = "analysis-ukrainian"
        plugins = "https://s3.amazonaws.com/downloads.mesosphere.io/infinity-artifacts/elastic/analysis-ukrainian-7.9.3.zip"
        _check_proxy_healthy(proxy_host, proxy_port, plugins)

        sdk_service.update_configuration(
            package_name,
            service_name,
            {
                "elasticsearch": {
                    "plugins": plugins,
                    "plugin_http_proxy_host": proxy_host,
                    "plugin_http_proxy_port": proxy_port,
                    "plugin_https_proxy_host": proxy_host,
                    "plugin_https_proxy_port": proxy_port,
                }
            },
            config.DEFAULT_TASK_COUNT,
        )

        config.check_elasticsearch_plugin_installed(
            plugin_name,
            service_name=service_name,
            expected_nodes_count=current_expected_task_count -
            current_non_node_task_count,
        )
        _check_proxy_was_used()

        sdk_service.update_configuration(
            package_name,
            service_name,
            {"elasticsearch": {
                "plugins": ""
            }},
            current_expected_task_count,
        )
        config.check_elasticsearch_plugin_uninstalled(
            plugin_name, service_name=service_name)
    finally:
        _uninstall_and_kill_proxy()
示例#7
0
def test_plugin_install_and_uninstall(default_populated_index: None) -> None:
    plugins = "analysis-icu"

    sdk_service.update_configuration(
        package_name,
        service_name,
        {"elasticsearch": {"plugins": plugins}},
        current_expected_task_count,
    )

    config.check_elasticsearch_plugin_installed(plugins, service_name=service_name)

    sdk_service.update_configuration(
        package_name, service_name, {"elasticsearch": {"plugins": ""}}, current_expected_task_count
    )

    config.check_elasticsearch_plugin_uninstalled(plugins, service_name=service_name)
示例#8
0
def test_xpack_toggle_with_kibana(default_populated_index):
    log.info("\n***** Verify X-Pack disabled by default in elasticsearch")
    config.verify_commercial_api_status(False, service_name=foldered_name)

    log.info("\n***** Test kibana with X-Pack disabled...")
    elasticsearch_url = "http://" + sdk_hosts.vip_host(foldered_name, "coordinator", 9200)
    sdk_install.install(
        config.KIBANA_PACKAGE_NAME,
        config.KIBANA_PACKAGE_NAME,
        0,
        { "kibana": {
            "elasticsearch_url": elasticsearch_url
        }},
        timeout_seconds=config.KIBANA_DEFAULT_TIMEOUT,
        wait_for_deployment=False,
        insert_strict_options=False)
    config.check_kibana_adminrouter_integration(
        "service/{}/".format(config.KIBANA_PACKAGE_NAME))
    log.info("Uninstall kibana with X-Pack disabled")
    sdk_install.uninstall(config.KIBANA_PACKAGE_NAME, config.KIBANA_PACKAGE_NAME)

    log.info("\n***** Set/verify X-Pack enabled in elasticsearch. Requires parallel upgrade strategy for full restart.")
    config.set_xpack(True, service_name=foldered_name)
    config.check_elasticsearch_plugin_installed(config.XPACK_PLUGIN_NAME, service_name=foldered_name)
    config.verify_commercial_api_status(True, service_name=foldered_name)
    config.verify_xpack_license(service_name=foldered_name)

    log.info("\n***** Write some data while enabled, disable X-Pack, and verify we can still read what we wrote.")
    config.create_document(
        config.DEFAULT_INDEX_NAME,
        config.DEFAULT_INDEX_TYPE,
        2,
        {"name": "X-Pack", "role": "commercial plugin"},
        service_name=foldered_name)

    log.info("\n***** Test kibana with X-Pack enabled...")
    log.info("\n***** Installing Kibana w/X-Pack can exceed default 15 minutes for Marathon "
             "deployment to complete due to a configured HTTP health check. (typical: 12 minutes)")
    sdk_install.install(
        config.KIBANA_PACKAGE_NAME,
        config.KIBANA_PACKAGE_NAME,
        0,
        { "kibana": {
            "elasticsearch_url": elasticsearch_url,
            "xpack_enabled": True
        }},
        timeout_seconds=config.KIBANA_DEFAULT_TIMEOUT,
        wait_for_deployment=False,
        insert_strict_options=False)
    config.check_kibana_plugin_installed(config.XPACK_PLUGIN_NAME, service_name=config.KIBANA_PACKAGE_NAME)
    config.check_kibana_adminrouter_integration("service/{}/login".format(config.KIBANA_PACKAGE_NAME))
    log.info("\n***** Uninstall kibana with X-Pack enabled")
    sdk_install.uninstall(config.KIBANA_PACKAGE_NAME, config.KIBANA_PACKAGE_NAME)

    log.info("\n***** Disable X-Pack in elasticsearch.")
    config.set_xpack(False, service_name=foldered_name)
    log.info("\n***** Verify we can still read what we wrote when X-Pack was enabled.")
    config.verify_commercial_api_status(False, service_name=foldered_name)
    doc = config.get_document(config.DEFAULT_INDEX_NAME, config.DEFAULT_INDEX_TYPE, 2, service_name=foldered_name)
    assert doc["_source"]["name"] == "X-Pack"

    # reset upgrade strategy to serial
    config.update_app(foldered_name, {'UPDATE_STRATEGY': 'serial'}, current_expected_task_count)

    sdk_plan.wait_for_completed_deployment(foldered_name)
    sdk_plan.wait_for_completed_recovery(foldered_name)