aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject incubator-aurora git commit: Fix user agent support for DirectSchedulerClient.
Date Wed, 07 Jan 2015 23:57:49 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 3b6d24d12 -> eab94dc10


Fix user agent support for DirectSchedulerClient.

Bugs closed: AURORA-988

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


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

Branch: refs/heads/master
Commit: eab94dc1060eed2f024b27b067b58a3079473ca4
Parents: 3b6d24d
Author: Joshua Cohen <jcohen@twopensource.com>
Authored: Wed Jan 7 15:57:16 2015 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Wed Jan 7 15:57:16 2015 -0800

----------------------------------------------------------------------
 .../apache/aurora/client/api/scheduler_client.py     |  4 ++--
 .../aurora/client/api/test_scheduler_client.py       | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/eab94dc1/src/main/python/apache/aurora/client/api/scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/scheduler_client.py b/src/main/python/apache/aurora/client/api/scheduler_client.py
index a319a1e..5d029a8 100644
--- a/src/main/python/apache/aurora/client/api/scheduler_client.py
+++ b/src/main/python/apache/aurora/client/api/scheduler_client.py
@@ -179,8 +179,8 @@ class ZookeeperSchedulerClient(SchedulerClient):
 
 
 class DirectSchedulerClient(SchedulerClient):
-  def __init__(self, uri):
-    SchedulerClient.__init__(self, verbose=True)
+  def __init__(self, uri, **kwargs):
+    SchedulerClient.__init__(self, verbose=True, **kwargs)
     self._uri = uri
 
   def _connect(self):

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/eab94dc1/src/test/python/apache/aurora/client/api/test_scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_scheduler_client.py b/src/test/python/apache/aurora/client/api/test_scheduler_client.py
index a3a40b7..a6e37d2 100644
--- a/src/test/python/apache/aurora/client/api/test_scheduler_client.py
+++ b/src/test/python/apache/aurora/client/api/test_scheduler_client.py
@@ -435,3 +435,18 @@ def test_transient_error(_, client):
   proxy.killTasks(TaskQuery(), None)
 
   assert mock_thrift_client.killTasks.call_count == 3
+
+
+@mock.patch('apache.aurora.client.api.scheduler_client.TRequestsTransport', spec=TRequestsTransport)
+def test_connect_direct_scheduler_with_user_agent(mock_transport):
+  mock_transport.return_value.open.side_effect = [TTransport.TTransportException, True]
+  mock_time = mock.create_autospec(spec=time, instance=True)
+
+  user_agent = 'Some-User-Agent'
+  uri = 'https://scheduler.example.com:1337'
+
+  client = scheduler_client.DirectSchedulerClient(uri, user_agent=user_agent)
+
+  client._connect_scheduler(uri, mock_time)
+
+  mock_transport.assert_called_once_with(uri, user_agent=user_agent)


Mime
View raw message