summaryrefslogtreecommitdiff
path: root/ironic/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ironic/tests')
-rw-r--r--ironic/tests/api/v1/test_nodes.py30
-rw-r--r--ironic/tests/drivers/test_deploy_utils.py21
2 files changed, 44 insertions, 7 deletions
diff --git a/ironic/tests/api/v1/test_nodes.py b/ironic/tests/api/v1/test_nodes.py
index f24fbefe6..85a80c9ca 100644
--- a/ironic/tests/api/v1/test_nodes.py
+++ b/ironic/tests/api/v1/test_nodes.py
@@ -903,6 +903,11 @@ class TestPut(base.FunctionalTest):
self.node['uuid'],
states.POWER_ON,
'test-topic')
+ # Check location header
+ self.assertIsNotNone(response.location)
+ expected_location = '/v1/nodes/%s/states' % self.node.uuid
+ self.assertEqual(urlparse.urlparse(response.location).path,
+ expected_location)
def test_power_invalid_state_request(self):
ret = self.put_json('/nodes/%s/states/power' % self.node.uuid,
@@ -916,6 +921,11 @@ class TestPut(base.FunctionalTest):
self.assertEqual('', ret.body)
self.mock_dnd.assert_called_once_with(
mock.ANY, self.node.uuid, False, 'test-topic')
+ # Check location header
+ self.assertIsNotNone(ret.location)
+ expected_location = '/v1/nodes/%s/states' % self.node.uuid
+ self.assertEqual(urlparse.urlparse(ret.location).path,
+ expected_location)
def test_provision_with_tear_down(self):
ret = self.put_json('/nodes/%s/states/provision' % self.node.uuid,
@@ -924,6 +934,11 @@ class TestPut(base.FunctionalTest):
self.assertEqual('', ret.body)
self.mock_dntd.assert_called_once_with(
mock.ANY, self.node.uuid, 'test-topic')
+ # Check location header
+ self.assertIsNotNone(ret.location)
+ expected_location = '/v1/nodes/%s/states' % self.node.uuid
+ self.assertEqual(urlparse.urlparse(ret.location).path,
+ expected_location)
def test_provision_invalid_state_request(self):
ret = self.put_json('/nodes/%s/states/provision' % self.node.uuid,
@@ -950,6 +965,11 @@ class TestPut(base.FunctionalTest):
self.assertEqual('', ret.body)
self.mock_dntd.assert_called_once_with(
mock.ANY, node.uuid, 'test-topic')
+ # Check location header
+ self.assertIsNotNone(ret.location)
+ expected_location = '/v1/nodes/%s/states' % node.uuid
+ self.assertEqual(urlparse.urlparse(ret.location).path,
+ expected_location)
def test_provision_already_in_state(self):
node = obj_utils.create_test_node(
@@ -970,6 +990,11 @@ class TestPut(base.FunctionalTest):
self.assertEqual('', ret.body)
mock_scm.assert_called_once_with(mock.ANY, self.node.uuid,
True, 'test-topic')
+ # Check location header
+ self.assertIsNotNone(ret.location)
+ expected_location = '/v1/nodes/%s/states/console' % self.node.uuid
+ self.assertEqual(urlparse.urlparse(ret.location).path,
+ expected_location)
def test_set_console_mode_disabled(self):
with mock.patch.object(rpcapi.ConductorAPI, 'set_console_mode') \
@@ -980,6 +1005,11 @@ class TestPut(base.FunctionalTest):
self.assertEqual('', ret.body)
mock_scm.assert_called_once_with(mock.ANY, self.node.uuid,
False, 'test-topic')
+ # Check location header
+ self.assertIsNotNone(ret.location)
+ expected_location = '/v1/nodes/%s/states/console' % self.node.uuid
+ self.assertEqual(urlparse.urlparse(ret.location).path,
+ expected_location)
def test_set_console_mode_bad_request(self):
with mock.patch.object(rpcapi.ConductorAPI, 'set_console_mode') \
diff --git a/ironic/tests/drivers/test_deploy_utils.py b/ironic/tests/drivers/test_deploy_utils.py
index 75ea1d3fd..4cbb8b459 100644
--- a/ironic/tests/drivers/test_deploy_utils.py
+++ b/ironic/tests/drivers/test_deploy_utils.py
@@ -110,7 +110,8 @@ class PhysicalWorkTestCase(tests_base.TestCase):
mock.call.login_iscsi(address, port, iqn),
mock.call.is_block_device(dev),
mock.call.make_partitions(dev, root_mb, swap_mb,
- ephemeral_mb),
+ ephemeral_mb,
+ commit=True),
mock.call.is_block_device(root_part),
mock.call.is_block_device(swap_part),
mock.call.dd(image_path, root_part),
@@ -160,7 +161,8 @@ class PhysicalWorkTestCase(tests_base.TestCase):
mock.call.login_iscsi(address, port, iqn),
mock.call.is_block_device(dev),
mock.call.make_partitions(dev, root_mb, swap_mb,
- ephemeral_mb),
+ ephemeral_mb,
+ commit=True),
mock.call.is_block_device(root_part),
mock.call.dd(image_path, root_part),
mock.call.block_uuid(root_part),
@@ -212,7 +214,8 @@ class PhysicalWorkTestCase(tests_base.TestCase):
mock.call.login_iscsi(address, port, iqn),
mock.call.is_block_device(dev),
mock.call.make_partitions(dev, root_mb, swap_mb,
- ephemeral_mb),
+ ephemeral_mb,
+ commit=True),
mock.call.is_block_device(root_part),
mock.call.is_block_device(swap_part),
mock.call.is_block_device(ephemeral_part),
@@ -273,7 +276,8 @@ class PhysicalWorkTestCase(tests_base.TestCase):
mock.call.login_iscsi(address, port, iqn),
mock.call.is_block_device(dev),
mock.call.make_partitions(dev, root_mb, swap_mb,
- ephemeral_mb),
+ ephemeral_mb,
+ commit=False),
mock.call.is_block_device(root_part),
mock.call.is_block_device(swap_part),
mock.call.is_block_device(ephemeral_part),
@@ -430,7 +434,8 @@ class WorkOnDiskTestCase(tests_base.TestCase):
self.ephemeral_format, self.image_path, False)
self.assertEqual(self.mock_ibd.call_args_list, calls)
self.mock_mp.assert_called_once_with(self.dev, self.root_mb,
- self.swap_mb, self.ephemeral_mb)
+ self.swap_mb, self.ephemeral_mb,
+ commit=True)
def test_no_swap_partition(self):
self.mock_ibd.side_effect = [True, True, False]
@@ -443,7 +448,8 @@ class WorkOnDiskTestCase(tests_base.TestCase):
self.ephemeral_format, self.image_path, False)
self.assertEqual(self.mock_ibd.call_args_list, calls)
self.mock_mp.assert_called_once_with(self.dev, self.root_mb,
- self.swap_mb, self.ephemeral_mb)
+ self.swap_mb, self.ephemeral_mb,
+ commit=True)
def test_no_ephemeral_partition(self):
ephemeral_part = '/dev/fake-part1'
@@ -466,7 +472,8 @@ class WorkOnDiskTestCase(tests_base.TestCase):
self.image_path, False)
self.assertEqual(self.mock_ibd.call_args_list, calls)
self.mock_mp.assert_called_once_with(self.dev, self.root_mb,
- self.swap_mb, ephemeral_mb)
+ self.swap_mb, ephemeral_mb,
+ commit=True)
@mock.patch.object(time, 'sleep', lambda _: None)