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_SERVICE_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_SERVICE_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") config.enable_xpack(service_name=FOLDERED_SERVICE_NAME) config.verify_commercial_api_status( True, service_name=FOLDERED_SERVICE_NAME) config.verify_xpack_license(service_name=FOLDERED_SERVICE_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_SERVICE_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_SERVICE_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_SERVICE_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_SERVICE_NAME) doc = config.get_document( config.DEFAULT_INDEX_NAME, config.DEFAULT_INDEX_TYPE, 2, service_name=FOLDERED_SERVICE_NAME) assert doc["_source"]["name"] == "X-Pack"
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)