def test_plugin_install_and_uninstall(default_populated_index): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) plugin_name = 'analysis-phonetic' config.update_app(foldered_name, {'TASKCFG_ALL_ELASTICSEARCH_PLUGINS': plugin_name}, current_expected_task_count) config.check_plugin_installed(plugin_name, service_name=foldered_name) config.update_app(foldered_name, {'TASKCFG_ALL_ELASTICSEARCH_PLUGINS': ''}, current_expected_task_count) config.check_plugin_uninstalled(plugin_name, service_name=foldered_name)
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)
def test_xpack_toggle_with_kibana(default_populated_index): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) 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...") shakedown.install_package(config.KIBANA_PACKAGE_NAME, options_json={ "kibana": {"elasticsearch_url": "http://" + sdk_hosts.vip_host(foldered_name, "coordinator", 9200)}}) shakedown.deployment_wait( app_id="/{}".format(config.KIBANA_PACKAGE_NAME), timeout=config.DEFAULT_KIBANA_TIMEOUT) 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.enable_xpack(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...") shakedown.install_package(config.KIBANA_PACKAGE_NAME, options_json={ "kibana": { "elasticsearch_url": "http://" + sdk_hosts.vip_host(foldered_name, "coordinator", 9200), "xpack_enabled": True }}) log.info("\n***** Installing Kibana w/X-Pack can take as much as 15 minutes for Marathon deployment ") log.info("to complete due to a configured HTTP health check. (typical: 12 minutes)") shakedown.deployment_wait(app_id="/{}".format(config.KIBANA_PACKAGE_NAME), timeout=config.DEFAULT_KIBANA_TIMEOUT) 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.disable_xpack(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)
def test_custom_yaml_base64(): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) # apply this custom YAML block as a base64-encoded string: # cluster: # routing: # allocation: # node_initial_primaries_recoveries: 3 # The default value is 4. We're just testing to make sure the YAML formatting survived intact and the setting # got updated in the config. base64_str = 'Y2x1c3RlcjoNCiAgcm91dGluZzoNCiAgICBhbGxvY2F0aW9uOg0KIC' \ 'AgICAgbm9kZV9pbml0aWFsX3ByaW1hcmllc19yZWNvdmVyaWVzOiAz' config.update_app(foldered_name, {'TASKCFG_ALL_CUSTOM_YAML_BLOCK_BASE64': base64_str}, current_expected_task_count) config.check_custom_elasticsearch_cluster_setting(service_name=foldered_name)
def test_custom_yaml_base64(): # apply this custom YAML block as a base64-encoded string: # cluster: # routing: # allocation: # node_initial_primaries_recoveries: 3 # The default value is 4. We're just testing to make sure the YAML formatting survived intact and the setting # got updated in the config. base64_str = 'Y2x1c3RlcjoNCiAgcm91dGluZzoNCiAgICBhbGxvY2F0aW9uOg0KIC' \ 'AgICAgbm9kZV9pbml0aWFsX3ByaW1hcmllc19yZWNvdmVyaWVzOiAz' config.update_app(foldered_name, {'CUSTOM_YAML_BLOCK_BASE64': base64_str}, current_expected_task_count) config.check_custom_elasticsearch_cluster_setting(service_name=foldered_name) sdk_plan.wait_for_completed_deployment(foldered_name) sdk_plan.wait_for_completed_recovery(foldered_name)
def test_custom_yaml_base64(): # apply this custom YAML block as a base64-encoded string: # cluster: # routing: # allocation: # node_initial_primaries_recoveries: 3 # The default value is 4. We're just testing to make sure the YAML formatting survived intact and the setting # got updated in the config. base64_str = "Y2x1c3RlcjoNCiAgcm91dGluZzoNCiAgICBhbGxvY2F0aW9uOg0KIC" "AgICAgbm9kZV9pbml0aWFsX3ByaW1hcmllc19yZWNvdmVyaWVzOiAz" config.update_app(foldered_name, {"CUSTOM_YAML_BLOCK_BASE64": base64_str}, current_expected_task_count) config.check_custom_elasticsearch_cluster_setting( service_name=foldered_name) sdk_plan.wait_for_completed_deployment(foldered_name) sdk_plan.wait_for_completed_recovery(foldered_name)
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)