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))
 Case 4: direct namenode fails first two times thru, but 2nd retry succeeds.
petastorm/tests/test_fs_utils.py