aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject incubator-aurora git commit: Fixing admin query command
Date Thu, 27 Nov 2014 00:24:57 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 3310dc0da -> 8d45482e3


Fixing admin query command

Bugs closed: AURORA-936

Reviewed at https://reviews.apache.org/r/28450/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/8d45482e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/8d45482e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/8d45482e

Branch: refs/heads/master
Commit: 8d45482e326a004bf74631dab9ba5fbffdec6cc2
Parents: 3310dc0
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Wed Nov 26 16:24:33 2014 -0800
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Wed Nov 26 16:24:33 2014 -0800

----------------------------------------------------------------------
 .../python/apache/aurora/client/commands/admin.py    |  2 +-
 .../apache/aurora/client/commands/test_admin.py      | 15 +++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d45482e/src/main/python/apache/aurora/client/commands/admin.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/commands/admin.py b/src/main/python/apache/aurora/client/commands/admin.py
index 9719a58..cb5ae88 100644
--- a/src/main/python/apache/aurora/client/commands/admin.py
+++ b/src/main/python/apache/aurora/client/commands/admin.py
@@ -142,7 +142,7 @@ def query(args, options):
     die('--force is required for expensive queries (states outside ACTIVE states')
 
   api = AuroraClientAPI(CLUSTERS[cluster], options.verbosity)
-  query_info = api.query(api.build_query(role, job, instances=instances, statuses=states))
+  query_info = api.query(TaskQuery(role=role, jobName=job, instanceIds=instances, statuses=states))
   if query_info.responseCode != ResponseCode.OK:
     die('Failed to query scheduler: %s' % query_info.messageDEPRECATED)
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8d45482e/src/test/python/apache/aurora/client/commands/test_admin.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/commands/test_admin.py b/src/test/python/apache/aurora/client/commands/test_admin.py
index 7dd61cd..f9261af 100644
--- a/src/test/python/apache/aurora/client/commands/test_admin.py
+++ b/src/test/python/apache/aurora/client/commands/test_admin.py
@@ -82,13 +82,14 @@ class TestQueryCommand(AuroraClientCommandTest):
   @classmethod
   def task_query(cls):
     return TaskQuery(
-        jobKeys=[JobKey(role=None, environment=None, name=None)],
-        instanceIds=set(),
+        role='test_role',
+        jobName='test_job',
+        instanceIds=set([0]),
         statuses=set([ScheduleStatus.RUNNING]))
 
   def test_query(self):
     """Tests successful execution of the query command."""
-    mock_options = self.setup_mock_options(force=True)
+    mock_options = self.setup_mock_options(force=True, shards="0")
     mock_api, mock_scheduler_proxy = self.create_mock_api()
     with contextlib.nested(
         patch('twitter.common.app.get_options', return_value=mock_options),
@@ -97,13 +98,13 @@ class TestQueryCommand(AuroraClientCommandTest):
 
       mock_scheduler_proxy.getTasksStatus.return_value = self.create_response(self.create_task())
 
-      query([self.TEST_CLUSTER], mock_options)
+      query([self.TEST_CLUSTER, 'test_role', 'test_job'], mock_options)
 
       mock_scheduler_proxy.getTasksStatus.assert_called_with(self.task_query())
 
   def test_query_fails(self):
     """Tests failed execution of the query command."""
-    mock_options = self.setup_mock_options()
+    mock_options = self.setup_mock_options(shards="0")
     mock_api, mock_scheduler_proxy = self.create_mock_api()
     with contextlib.nested(
         patch('twitter.common.app.get_options', return_value=mock_options),
@@ -113,12 +114,14 @@ class TestQueryCommand(AuroraClientCommandTest):
       mock_scheduler_proxy.getTasksStatus.return_value = self.create_response(self.create_task())
 
       try:
-        query([self.TEST_CLUSTER], mock_options)
+        query([self.TEST_CLUSTER, 'test_role', 'test_job'], mock_options)
       except SystemExit:
         pass
       else:
         assert 'Expected exception is not raised'
 
+      mock_scheduler_proxy.getTasksStatus.assert_called_with(self.task_query())
+
 
 class TestIncreaseQuotaCommand(AuroraClientCommandTest):
 


Mime
View raw message