class_docstr: Checks the full filesystem resolution functionality, exercising each URL interpretation case.
docstr: Case 4: direct namenode fails first two times thru, but 2nd retry succeeds.
docstr_tok: ["Case","4",":","direct","namenode","fails","first","two","times","thru",",","but","2nd","retry","succeeds","."]
code: def test_hdfs_url_direct_namenode_retries(self):
      """Case 4: direct namenode fails first two times thru, but 2nd retry succeeds."""
      self.mock.set_fail_n_next_connect(2)
      with self.assertRaises(ArrowIOError):
          suj = FilesystemResolver(
              "hdfs://{}/path".format(HC.WARP_TURTLE_NN2),
              self._hadoop_configuration,
              connector=self.mock,
              user=self.mock_name,
          )
      self.assertEqual(
          1, self.mock.connect_attempted(HC.WARP_TURTLE_NN2)
      )
      self.assertEqual(
          0, self.mock.connect_attempted(HC.WARP_TURTLE_NN1)
      )
      self.assertEqual(0, self.mock.connect_attempted(HC.DEFAULT_NN))
      with self.assertRaises(ArrowIOError):
          suj = FilesystemResolver(
              "hdfs://{}/path".format(HC.WARP_TURTLE_NN2),
              self._hadoop_configuration,
              connector=self.mock,
          )
      self.assertEqual(
          2, self.mock.connect_attempted(HC.WARP_TURTLE_NN2)
      )
      self.assertEqual(
          0, self.mock.connect_attempted(HC.WARP_TURTLE_NN1)
      )
      self.assertEqual(0, self.mock.connect_attempted(HC.DEFAULT_NN))
      # this one should connect "successfully"
      suj = FilesystemResolver(
          "hdfs://{}/path".format(HC.WARP_TURTLE_NN2),
          self._hadoop_configuration,
          connector=self.mock,
          user=self.mock_name,
      )
      self.assertEqual(MockHdfs, type(suj.filesystem()))
      self.assertEqual(self.mock_name, suj.filesystem()._user)
      self.assertEqual(
          HC.WARP_TURTLE_NN2, suj.parsed_dataset_url().netloc
      )
      self.assertEqual(
          3, self.mock.connect_attempted(HC.WARP_TURTLE_NN2)
      )
      self.assertEqual(
          0, self.mock.connect_attempted(HC.WARP_TURTLE_NN1)
      )
      self.assertEqual(0, self.mock.connect_attempted(HC.DEFAULT_NN))
  
imports: import unittest
  import dill
  from pyarrow.filesystem import LocalFileSystem
  from pyarrow.lib import ArrowIOError
  from six.moves.urllib.parse import urlparse
  import gcsfs
  import s3fs
  from petastorm.fs_utils import FilesystemResolver, get_filesystem_and_path_or_paths
  from petastorm.hdfs.tests.test_hdfs_namenode import HC, MockHadoopConfiguration, MockHdfs, MockHdfsConnector
label_desc: Use image node_id 9 for calling the FilesystemResolverTest obj's underlying member method code with example usage: obj.test_hdfs_url_direct_namenode_retries() without return types