def test_invalid_namenode_list(self):
        """Make sure robust to invalid namenode list."""
        MockHdfsConnector.set_n_failovers(-1)
        with self.assertRaises(HdfsConnectError) as e:
            getattr(HAHdfsClient(MockHdfsConnector, []), 'ls')('random')
        self.assertTrue('Unable to connect' in str(e.exception))
        with self.assertRaises(HdfsConnectError) as e:
            getattr(HAHdfsClient(MockHdfsConnector, [None]), 'ls')('random')
        self.assertTrue('Unable to connect' in str(e.exception))
Make sure robust to invalid namenode list.
petastorm/hdfs/tests/test_hdfs_namenode.py