def test_config_validator_more(): # TODO: Setup DN to not load the plugin, which is a common user error. # We don't actually use the mini_cluster. But the cluster sets up the correct # configuration that forms the test basis. minicluster = pseudo_hdfs4.shared_cluster() cli = make_logged_in_client() reset = ( conf.MR_CLUSTERS["default"].HOST.set_for_testing("localhost"), conf.MR_CLUSTERS['default'].JT_THRIFT_PORT.set_for_testing(23), ) old = cluster.clear_caches() try: resp = cli.get('/debug/check_config') assert_false('Failed to access filesystem root' in resp.content) assert_false('Failed to create' in resp.content) assert_false('Failed to chown' in resp.content) assert_false('Failed to delete' in resp.content) assert_true('Failed to contact JobTracker plugin' in resp.content) finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def test_config_validator_basic(): reset = ( conf.HDFS_CLUSTERS['default'].WEBHDFS_URL.set_for_testing('http://not.the.re:50070/'), conf.MR_CLUSTERS['default'].JT_THRIFT_PORT.set_for_testing(70000), ) old = cluster.clear_caches() try: cli = make_logged_in_client() resp = cli.get('/debug/check_config') assert_true('hadoop.hdfs_clusters.default.webhdfs_url' in resp.content) finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def test_config_validator_basic(): reset = ( conf.HDFS_CLUSTERS['default'].WEBHDFS_URL.set_for_testing( 'http://not.the.re:50070/'), conf.MR_CLUSTERS['default'].JT_THRIFT_PORT.set_for_testing(70000), ) old = cluster.clear_caches() try: cli = make_logged_in_client() resp = cli.get('/desktop/debug/check_config') assert_true('hadoop.hdfs_clusters.default.webhdfs_url' in resp.content) finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def test_config_validator_basic(): reset = ( conf.HDFS_CLUSTERS["default"].WEBHDFS_URL.set_for_testing("http://not.the.re:50070/"), conf.MR_CLUSTERS["default"].JT_THRIFT_PORT.set_for_testing(70000), ) old = cluster.clear_caches() try: cli = make_logged_in_client() resp = cli.get("/debug/check_config") assert_true("hadoop.hdfs_clusters.default.webhdfs_url" in resp.content) assert_true("hadoop.mapred_clusters.default.thrift_port" in resp.content) assert_true("Port should be" in resp.content) finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def test_config_validator_more(): # TODO: Setup DN to not load the plugin, which is a common user error. # We don't actually use the mini_cluster. But the cluster sets up the correct # configuration that forms the test basis. minicluster = pseudo_hdfs4.shared_cluster() cli = make_logged_in_client() old = cluster.clear_caches() try: resp = cli.get('/debug/check_config') assert_false('Failed to access filesystem root' in resp.content) assert_false('Failed to create' in resp.content) assert_false('Failed to chown' in resp.content) assert_false('Failed to delete' in resp.content) finally: cluster.restore_caches(old)
def test_non_default_cluster(): NON_DEFAULT_NAME = 'non_default' old = cluster.clear_caches() reset = ( conf.HDFS_CLUSTERS.set_for_testing({NON_DEFAULT_NAME: {}}), conf.MR_CLUSTERS.set_for_testing({NON_DEFAULT_NAME: {}}), ) try: # This is indeed the only hdfs/mr cluster assert_equal(1, len(cluster.get_all_hdfs())) assert_equal(1, len(cluster.all_mrclusters())) assert_true(cluster.get_hdfs(NON_DEFAULT_NAME)) assert_true(cluster.get_mrcluster(NON_DEFAULT_NAME)) cli = make_logged_in_client() # That we can get to a view without errors means that the middlewares work cli.get('/about') finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def test_non_default_cluster(): NON_DEFAULT_NAME = 'non_default' old = cluster.clear_caches() reset = ( conf.HDFS_CLUSTERS.set_for_testing({ NON_DEFAULT_NAME: { } }), conf.YARN_CLUSTERS.set_for_testing({ NON_DEFAULT_NAME: { "submit_to": True } }), ) try: # This is indeed the only hdfs/mr cluster assert_equal(1, len(cluster.get_all_hdfs())) assert_true(cluster.get_hdfs(NON_DEFAULT_NAME)) assert_true(cluster.get_yarn()) cli = make_logged_in_client() # That we can get to a view without errors means that the middlewares work cli.get('/about') finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def test_config_validator_more(): # TODO: Setup DN to not load the plugin, which is a common user error. # We don't actually use the mini_cluster. But the cluster sets up the correct # configuration that forms the test basis. minicluster = pseudo_hdfs4.shared_cluster() cli = make_logged_in_client() reset = ( conf.MR_CLUSTERS["default"].HOST.set_for_testing("localhost"), conf.MR_CLUSTERS['default'].JT_THRIFT_PORT.set_for_testing(23), ) old = cluster.clear_caches() try: resp = cli.get('/debug/check_config') assert_false('Failed to access filesystem root' in resp.content) assert_false('Failed to create' in resp.content) assert_false('Failed to chown' in resp.content) assert_false('Failed to delete' in resp.content) finally: for old_conf in reset: old_conf() cluster.restore_caches(old)
def restore_sys_caches(old_caches): cluster.restore_caches(old_caches[0]) fsmanager.restore_cache(old_caches[1])
def restore_sys_caches(old_caches): cluster.restore_caches(old_caches[0])