[ARVADOS] updated: 788b8d7247da8c4592b1f9d482fff4e1509f57f3
Git user
git at public.curoverse.com
Tue Apr 12 10:51:45 EDT 2016
Summary of changes:
.../arvnodeman/computenode/driver/__init__.py | 6 +++---
.../tests/test_computenode_driver_azure.py | 14 ++++++++++++++
.../nodemanager/tests/test_computenode_driver_gce.py | 5 +++++
services/nodemanager/tests/testutil.py | 20 +++++++++++++++++---
4 files changed, 39 insertions(+), 6 deletions(-)
via 788b8d7247da8c4592b1f9d482fff4e1509f57f3 (commit)
via 32eb510594a45b395d1a0c8dafda1a94c86c0a9f (commit)
from 9c3de7371b820b1cecf1f3b0117773a11c5f5883 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 788b8d7247da8c4592b1f9d482fff4e1509f57f3
Merge: 9c3de73 32eb510
Author: Brett Smith <brett at curoverse.com>
Date: Tue Apr 12 10:51:28 2016 -0400
Merge branch '8912-node-manager-patch-nodes-wip'
Closes #8913, #8923. (The branch name has a typo.)
commit 32eb510594a45b395d1a0c8dafda1a94c86c0a9f
Author: Brett Smith <brett at curoverse.com>
Date: Fri Apr 8 18:56:44 2016 -0400
8912: Node Manager search_for_now uses overridden methods.
This wasn't possible in the original implementation because of the way
we used to proxy methods to self.real. Now that we proxy them
transparently, we can call methods on the Node Manager driver, and let
them be proxied to the underlying libcloud driver if needed.
diff --git a/services/nodemanager/arvnodeman/computenode/driver/__init__.py b/services/nodemanager/arvnodeman/computenode/driver/__init__.py
index 95b6fa8..1bf2493 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/__init__.py
@@ -86,13 +86,13 @@ class BaseComputeNodeDriver(RetryMixin):
Arguments:
* term: The value that identifies a matching item.
- * list_method: A string that names the method to call on this
- instance's libcloud driver for a list of objects.
+ * list_method: A string that names the method to call for a
+ list of objects.
* key: A function that accepts a cloud object and returns a
value search for a `term` match on each item. Returns the
object's 'id' attribute by default.
"""
- items = getattr(self.real, list_method)(**kwargs)
+ items = getattr(self, list_method)(**kwargs)
results = [item for item in items if key(item) == term]
count = len(results)
if count != 1:
diff --git a/services/nodemanager/tests/test_computenode_driver_azure.py b/services/nodemanager/tests/test_computenode_driver_azure.py
index 8e701b9..59fc503 100644
--- a/services/nodemanager/tests/test_computenode_driver_azure.py
+++ b/services/nodemanager/tests/test_computenode_driver_azure.py
@@ -120,3 +120,17 @@ echo z1.test > /var/tmp/arv-node-data/meta-data/instance-type
n = driver.list_nodes()
self.assertEqual(nodelist, n)
self.driver_mock().list_nodes.assert_called_with(ex_fetch_nic=False, ex_resource_group='TestResourceGroup')
+
+ def test_create_can_find_node_after_timeout(self):
+ super(AzureComputeNodeDriverTestCase,
+ self).test_create_can_find_node_after_timeout(
+ create_kwargs={'tag_arvados-class': 'test'},
+ node_extra={'tags': {'arvados-class': 'test'}})
+
+ def test_node_found_after_timeout_has_fixed_size(self):
+ size = testutil.MockSize(4)
+ node_props = {'hardwareProfile': {'vmSize': size.id}}
+ cloud_node = testutil.cloud_node_mock(
+ size=None, tags={'arvados-class': 'test'}, properties=node_props)
+ self.check_node_found_after_timeout_has_fixed_size(
+ size, cloud_node, {'tag_arvados-class': 'test'})
diff --git a/services/nodemanager/tests/test_computenode_driver_gce.py b/services/nodemanager/tests/test_computenode_driver_gce.py
index e8b2fa3..84e061d 100644
--- a/services/nodemanager/tests/test_computenode_driver_gce.py
+++ b/services/nodemanager/tests/test_computenode_driver_gce.py
@@ -231,6 +231,11 @@ class GCEComputeNodeDriverTestCase(testutil.DriverTestMixin, unittest.TestCase):
self.assertIs(node, nodelist[0])
self.assertIs(size, nodelist[0].size)
+ def test_node_found_after_timeout_has_fixed_size(self):
+ size = testutil.MockSize(4)
+ cloud_node = testutil.cloud_node_mock(size=size.id)
+ self.check_node_found_after_timeout_has_fixed_size(size, cloud_node)
+
def test_list_empty_nodes(self):
self.driver_mock().list_nodes.return_value = []
self.assertEqual([], self.new_driver().list_nodes())
diff --git a/services/nodemanager/tests/testutil.py b/services/nodemanager/tests/testutil.py
index b376ca7..a17f088 100644
--- a/services/nodemanager/tests/testutil.py
+++ b/services/nodemanager/tests/testutil.py
@@ -143,10 +143,10 @@ class DriverTestMixin(object):
self.assertTrue(self.driver_mock.called)
self.assertIs(driver.real, driver_mock2)
- def test_create_can_find_node_after_timeout(self):
- driver = self.new_driver()
+ def test_create_can_find_node_after_timeout(self, create_kwargs={}, node_extra={}):
+ driver = self.new_driver(create_kwargs=create_kwargs)
arv_node = arvados_node_mock()
- cloud_node = cloud_node_mock()
+ cloud_node = cloud_node_mock(**node_extra)
cloud_node.name = driver.create_cloud_name(arv_node)
create_method = self.driver_mock().create_node
create_method.side_effect = cloud_types.LibcloudError("fake timeout")
@@ -166,6 +166,20 @@ class DriverTestMixin(object):
driver.create_node(MockSize(1), arv_node)
self.assertIs(create_method.side_effect, exc_test.exception)
+ def check_node_found_after_timeout_has_fixed_size(self, size, cloud_node,
+ create_kwargs={}):
+ # This method needs to be called explicitly by driver test suites
+ # that need it.
+ self.driver_mock().list_sizes.return_value = [size]
+ driver = self.new_driver(create_kwargs=create_kwargs)
+ arv_node = arvados_node_mock()
+ cloud_node.name = driver.create_cloud_name(arv_node)
+ create_method = self.driver_mock().create_node
+ create_method.side_effect = cloud_types.LibcloudError("fake timeout")
+ self.driver_mock().list_nodes.return_value = [cloud_node]
+ actual = driver.create_node(size, arv_node)
+ self.assertIs(size, actual.size)
+
class RemotePollLoopActorTestMixin(ActorTestMixin):
def build_monitor(self, *args, **kwargs):
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list