tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
def testHdfsFallbackToNamenodeRpcAddressSuccess(self):
    """With hdfs, absence of fs.default.name successfully uses rpc-address."""
    self._SetDefaultValidFlags()
    self._flag_values_copy.dry_run = False

    self._flag_values_copy.default_fs = 'hdfs'

    self._flag_values_copy.namenode_uri = None

    namenode_uri = 'hdfs://localhost:8020/'
    conf = xml_configuration.Configuration.FromFile(self._hdfs_site_filename)
    conf.Update({'dfs.namenode.rpc-address': namenode_uri}, {})
    conf.WriteToFile(self._hdfs_site_filename)

    self._test_cmd.Run(None)

    conf = xml_configuration.Configuration.FromFile(self._core_site_filename)
    self.assertEqual(1, conf.GetNumProperties())

    self.assertEqual(
        namenode_uri, conf.GetPropertyValue('fs.default.name'))

    self._flag_values_copy.namenode_uri = 'hdfs://some-other-host:8020/'
    self._test_cmd.Run(None)
    conf = xml_configuration.Configuration.FromFile(self._core_site_filename)
    self.assertEqual(1, conf.GetNumProperties())
    self.assertEqual(
        self._flag_values_copy.namenode_uri,
        conf.GetPropertyValue('fs.default.name'))
With hdfs, absence of fs.default.name successfully uses rpc-address.
With hdfs, absence of fs.default.name successfully uses rpc-address.
With hdfs absence of fs . default . name successfully uses rpc - address .
def testHdfsFallbackToNamenodeRpcAddressSuccess(self):
    self._SetDefaultValidFlags()
    self._flag_values_copy.dry_run = False
    self._flag_values_copy.default_fs = 'hdfs'
    self._flag_values_copy.namenode_uri = None
    namenode_uri = 'hdfs://localhost:8020/'
    conf = xml_configuration.Configuration.FromFile(self._hdfs_site_filename)
    conf.Update({'dfs.namenode.rpc-address': namenode_uri}, {})
    conf.WriteToFile(self._hdfs_site_filename)
    self._test_cmd.Run(None)
    conf = xml_configuration.Configuration.FromFile(self._core_site_filename)
    self.assertEqual(1, conf.GetNumProperties())
    self.assertEqual(
        namenode_uri, conf.GetPropertyValue('fs.default.name'))
    self._flag_values_copy.namenode_uri = 'hdfs://some-other-host:8020/'
    self._test_cmd.Run(None)
    conf = xml_configuration.Configuration.FromFile(self._core_site_filename)
    self.assertEqual(1, conf.GetNumProperties())
    self.assertEqual(
        self._flag_values_copy.namenode_uri,
        conf.GetPropertyValue('fs.default.name'))
def testHdfsFallbackToNamenodeRpcAddressSuccess ( self ) : self . _SetDefaultValidFlags ( ) self . _flag_values_copy . dry_run = False self . _flag_values_copy . default_fs = 'hdfs' self . _flag_values_copy . namenode_uri = None namenode_uri = 'hdfs://localhost:8020/' conf = xml_configuration . Configuration . FromFile ( self . _hdfs_site_filename ) conf . Update ( { 'dfs.namenode.rpc-address' : namenode_uri } , { } ) conf . WriteToFile ( self . _hdfs_site_filename ) self . _test_cmd . Run ( None ) conf = xml_configuration . Configuration . FromFile ( self . _core_site_filename ) self . assertEqual ( 1 , conf . GetNumProperties ( ) ) self . assertEqual ( namenode_uri , conf . GetPropertyValue ( 'fs.default.name' ) ) self . _flag_values_copy . namenode_uri = 'hdfs://some-other-host:8020/' self . _test_cmd . Run ( None ) conf = xml_configuration . Configuration . FromFile ( self . _core_site_filename ) self . assertEqual ( 1 , conf . GetNumProperties ( ) ) self . assertEqual ( self . _flag_values_copy . namenode_uri , conf . GetPropertyValue ( 'fs.default.name' ) )
With hdfs, absence of fs.default.name successfully uses rpc-address.
With hdfs absence of fs . default . name successfully uses rpc - address .
"""With hdfs, absence of fs.default.name successfully uses rpc-address."""
self