You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by qu...@apache.org on 2017/09/27 03:12:45 UTC

[02/14] libcloud git commit: renamed method from node_state to get_node_state

renamed method from node_state to get_node_state

Signed-off-by: Quentin Pradet <qu...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/513b9110
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/513b9110
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/513b9110

Branch: refs/heads/trunk
Commit: 513b9110bf62946695f0a0a8b817c32e4ba12cbc
Parents: e7df948
Author: Mika Lackman <mi...@upcloud.com>
Authored: Tue Sep 26 16:34:20 2017 +0300
Committer: Quentin Pradet <qu...@apache.org>
Committed: Wed Sep 27 07:04:33 2017 +0400

----------------------------------------------------------------------
 libcloud/common/upcloud.py           |  4 ++--
 libcloud/test/common/test_upcloud.py | 18 +++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/513b9110/libcloud/common/upcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/common/upcloud.py b/libcloud/common/upcloud.py
index 02413fc..b824664 100644
--- a/libcloud/common/upcloud.py
+++ b/libcloud/common/upcloud.py
@@ -108,7 +108,7 @@ class UpcloudNodeDestroyer(object):
         return self._do_destroy_node(node_id)
 
     def _do_destroy_node(self, node_id):
-        state = self._operations.node_state(node_id)
+        state = self._operations.get_node_state(node_id)
         if state == 'stopped':
             self._operations.destroy_node(node_id)
             return True
@@ -164,7 +164,7 @@ class UpcloudNodeOperations(object):
                                 method='POST',
                                 data=json.dumps(body))
 
-    def node_state(self, node_id):
+    def get_node_state(self, node_id):
         """
         Get the state of the node.
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/513b9110/libcloud/test/common/test_upcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/test/common/test_upcloud.py b/libcloud/test/common/test_upcloud.py
index 76dd9c1..2df8213 100644
--- a/libcloud/test/common/test_upcloud.py
+++ b/libcloud/test/common/test_upcloud.py
@@ -142,7 +142,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.destroyer = UpcloudNodeDestroyer(self.mock_operations, sleep_func=self.mock_sleep)
 
     def test_node_already_in_stopped_state(self):
-        self.mock_operations.node_state.side_effect = ['stopped']
+        self.mock_operations.get_node_state.side_effect = ['stopped']
 
         self.assertTrue(self.destroyer.destroy_node(1))
 
@@ -150,7 +150,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.mock_operations.destroy_node.assert_called_once_with(1)
 
     def test_node_in_error_state(self):
-        self.mock_operations.node_state.side_effect = ['error']
+        self.mock_operations.get_node_state.side_effect = ['error']
 
         self.assertFalse(self.destroyer.destroy_node(1))
 
@@ -158,7 +158,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.assertTrue(self.mock_operations.destroy_node.call_count == 0)
 
     def test_node_in_started_state(self):
-        self.mock_operations.node_state.side_effect = ['started', 'stopped']
+        self.mock_operations.get_node_state.side_effect = ['started', 'stopped']
 
         self.assertTrue(self.destroyer.destroy_node(1))
 
@@ -166,7 +166,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.mock_operations.destroy_node.assert_called_once_with(1)
 
     def test_node_in_maintenace_state(self):
-        self.mock_operations.node_state.side_effect = ['maintenance', 'maintenance', None]
+        self.mock_operations.get_node_state.side_effect = ['maintenance', 'maintenance', None]
 
         self.assertTrue(self.destroyer.destroy_node(1))
 
@@ -176,7 +176,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.assertTrue(self.mock_operations.destroy_node.call_count == 0)
 
     def test_node_statys_in_started_state_for_awhile(self):
-        self.mock_operations.node_state.side_effect = ['started', 'started', 'stopped']
+        self.mock_operations.get_node_state.side_effect = ['started', 'started', 'stopped']
 
         self.assertTrue(self.destroyer.destroy_node(1))
 
@@ -187,7 +187,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
 
     def test_reuse(self):
         "Verify that internal flag self.destroyer._stop_node is handled properly"
-        self.mock_operations.node_state.side_effect = ['started', 'stopped', 'started', 'stopped']
+        self.mock_operations.get_node_state.side_effect = ['started', 'stopped', 'started', 'stopped']
         self.assertTrue(self.destroyer.destroy_node(1))
         self.assertTrue(self.destroyer.destroy_node(1))
 
@@ -195,16 +195,16 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.assertEquals(self.mock_operations.stop_node.call_count, 2)
 
     def test_timeout(self):
-        self.mock_operations.node_state.side_effect = ['maintenance'] * 50
+        self.mock_operations.get_node_state.side_effect = ['maintenance'] * 50
 
         self.assertRaises(UpcloudTimeoutException, self.destroyer.destroy_node, 1)
 
     def test_timeout_reuse(self):
         "Verify sleep count is handled properly"
-        self.mock_operations.node_state.side_effect = ['maintenance'] * 50
+        self.mock_operations.get_node_state.side_effect = ['maintenance'] * 50
         self.assertRaises(UpcloudTimeoutException, self.destroyer.destroy_node, 1)
 
-        self.mock_operations.node_state.side_effect = ['maintenance', None]
+        self.mock_operations.get_node_state.side_effect = ['maintenance', None]
         self.assertTrue(self.destroyer.destroy_node(1))