def test_config_validator_basic(): reset = ( conf.HDFS_CLUSTERS.set_for_testing({'default': {}}), conf.HDFS_CLUSTERS['default'].WEBHDFS_URL.set_for_testing('http://not.the.re:50070/'), conf.MR_CLUSTERS.set_for_testing({'default': {}}), conf.MR_CLUSTERS['default'].JT_THRIFT_PORT.set_for_testing(70000), ) old_caches = clear_sys_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() restore_sys_caches(old_caches)
def test_config_validator_basic(): reset = ( conf.HDFS_CLUSTERS.set_for_testing({'default': {}}), conf.HDFS_CLUSTERS['default'].WEBHDFS_URL.set_for_testing('http://not.the.re:50070/'), conf.MR_CLUSTERS.set_for_testing({'default': {}}), conf.MR_CLUSTERS['default'].JT_THRIFT_PORT.set_for_testing(70000), ) old_caches = clear_sys_caches() try: cli = make_logged_in_client() resp = cli.get('/desktop/debug/check_config') assert_true(b'hadoop.hdfs_clusters.default.webhdfs_url' in resp.content) finally: for old_conf in reset: old_conf() restore_sys_caches(old_caches)
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_caches = clear_sys_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: restore_sys_caches(old_caches)
def test_non_default_cluster(): NON_DEFAULT_NAME = 'non_default' old_caches = clear_sys_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_true(cluster.get_hdfs(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() restore_sys_caches(old_caches)
def test_non_default_cluster(): NON_DEFAULT_NAME = 'non_default' old_caches = clear_sys_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() restore_sys_caches(old_caches)
def finish(): if conf: restore_sys_caches(old_caches) for x in closers: x()
def restore_config(): restore_sys_caches(old_caches) for x in closers: x()