Esempio n. 1
0
  def test_successful_status_nometadata(self):
    """Test the status command with no metadata."""
    # Calls api.check_status, which calls scheduler_proxy.getJobs
    mock_options = self.setup_mock_options()
    (mock_api, mock_scheduler_proxy) = self.create_mock_api()
    mock_scheduler_proxy.getTasksWithoutConfigs.return_value = self.create_status_null_metadata()
    with contextlib.nested(
        patch('apache.aurora.client.api.SchedulerProxy', return_value=mock_scheduler_proxy),
        patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS),
        patch('twitter.common.app.get_options', return_value=mock_options)):

      status(['west/mchucarroll/test/hello'], mock_options)
      mock_scheduler_proxy.getTasksWithoutConfigs.assert_called_with(
          TaskQuery(jobKeys=[JobKey(role='mchucarroll', environment='test', name='hello')]))
Esempio n. 2
0
  def test_successful_status(self):
    """Test the status command."""
    # Calls api.check_status, which calls scheduler_proxy.getJobs
    fake_options = {}
    (mock_api, mock_scheduler_proxy) = self.create_mock_api()
    mock_scheduler_proxy.getTasksWithoutConfigs.return_value = self.create_status_response()
    with contextlib.nested(
        patch('apache.aurora.client.api.SchedulerProxy', return_value=mock_scheduler_proxy),
        patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS),
        patch('twitter.common.app.get_options', return_value=fake_options)):

      status(['west/mchucarroll/test/hello'], fake_options)
      # The status command sends a getTasksWithoutConfigs query to the scheduler,
      # and then prints the result.
      mock_scheduler_proxy.getTasksWithoutConfigs.assert_called_with(
          TaskQuery(jobKeys=[JobKey(role='mchucarroll', environment='test', name='hello')]))
  def test_successful_status_nopackages(self):
    """Test the status command with no packages."""
    # Calls api.check_status, which calls scheduler_proxy.getJobs
    mock_options = self.setup_mock_options()
    (mock_api, mock_scheduler_proxy) = self.create_mock_api()
    mock_scheduler_proxy.getTasksStatus.return_value = self.create_status_response_null_package()
    with contextlib.nested(
        patch('apache.aurora.client.api.SchedulerProxy', return_value=mock_scheduler_proxy),
        patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS),
        patch('twitter.common.app.get_options', return_value=mock_options)) as (
      mock_scheduler_proxy_class,
      mock_clusters,
      options):
      status(['west/mchucarroll/test/hello'], mock_options)

      mock_scheduler_proxy.getTasksStatus.assert_called_with(TaskQuery(jobName='hello',
          environment='test', owner=Identity(role='mchucarroll')))
Esempio n. 4
0
    def test_successful_status(self):
        """Test the status command."""
        # Calls api.check_status, which calls scheduler_proxy.getJobs
        mock_options = self.setup_mock_options()
        (mock_api, mock_scheduler_proxy) = self.create_mock_api()
        mock_scheduler_proxy.getTasksWithoutConfigs.return_value = self.create_status_response()
        with contextlib.nested(
            patch("apache.aurora.client.api.SchedulerProxy", return_value=mock_scheduler_proxy),
            patch("apache.aurora.client.factory.CLUSTERS", new=self.TEST_CLUSTERS),
            patch("twitter.common.app.get_options", return_value=mock_options),
        ):

            status(["west/mchucarroll/test/hello"], mock_options)
            # The status command sends a getTasksWithoutConfigs query to the scheduler,
            # and then prints the result.
            mock_scheduler_proxy.getTasksWithoutConfigs.assert_called_with(
                TaskQuery(jobKeys=[JobKey(role="mchucarroll", environment="test", name="hello")])
            )
Esempio n. 5
0
    def test_successful_status_nometadata(self):
        """Test the status command with no metadata."""
        # Calls api.check_status, which calls scheduler_proxy.getJobs
        mock_options = self.setup_mock_options()
        (mock_api, mock_scheduler_proxy) = self.create_mock_api()
        mock_scheduler_proxy.getTasksWithoutConfigs.return_value = self.create_status_null_metadata(
        )
        with contextlib.nested(
                patch('apache.aurora.client.api.SchedulerProxy',
                      return_value=mock_scheduler_proxy),
                patch('apache.aurora.client.factory.CLUSTERS',
                      new=self.TEST_CLUSTERS),
                patch('twitter.common.app.get_options',
                      return_value=mock_options)):

            status(['west/mchucarroll/test/hello'], mock_options)
            mock_scheduler_proxy.getTasksWithoutConfigs.assert_called_with(
                TaskQuery(jobName='hello',
                          environment='test',
                          owner=Identity(role='mchucarroll')))