def test_get_cluster_details_does_not_exist(self, mock_cluster_client):
   """
   Tests that an exception is thrown when cleanup attempts to get information
   for a cluster that does not exist.
   """
   cluster_metadata = MasterURLIdentifier(
       project_id='test-project', region='test-region')
   cluster_manager = DataprocClusterManager(cluster_metadata)
   from apache_beam.runners.interactive.dataproc.dataproc_cluster_manager import _LOGGER
   with self.assertLogs(
       _LOGGER,
       level='ERROR') as context_manager, self.assertRaises(ValueError):
     cluster_manager.get_cluster_details(cluster_metadata)
     self.assertTrue('Cluster does not exist' in context_manager.output[0])
 def test_get_cluster_details_other_exception(self, mock_cluster_client):
     """
 Tests that an exception is thrown when the exception is not handled by
 any other case under get_cluster_details.
 """
     cluster_metadata = MasterURLIdentifier(project_id='test-project',
                                            region='test-region')
     cluster_manager = DataprocClusterManager(cluster_metadata)
     from apache_beam.runners.interactive.dataproc.dataproc_cluster_manager import _LOGGER
     with self.assertLogs(
             _LOGGER, level='ERROR') as context_manager, self.assertRaises(
                 MockException):
         cluster_manager.get_cluster_details(cluster_metadata)
         self.assertTrue('Failed to get information for cluster' in
                         context_manager.output[0])
 def test_get_cluster_details_permission_denied(self, mock_cluster_client):
     """
 Tests that an exception is thrown when a user is trying to get information
 for a project without sufficient permissions to do so.
 """
     cluster_metadata = MasterURLIdentifier(project_id='test-project',
                                            region='test-region')
     cluster_manager = DataprocClusterManager(cluster_metadata)
     from apache_beam.runners.interactive.dataproc.dataproc_cluster_manager import _LOGGER
     with self.assertLogs(
             _LOGGER, level='ERROR') as context_manager, self.assertRaises(
                 ValueError):
         cluster_manager.get_cluster_details(cluster_metadata)
         self.assertTrue('Due to insufficient project permissions' in
                         context_manager.output[0])