Ejemplo n.º 1
0
    def test__delete_node(self):
        mock_node_delete = mock.Mock()
        self.admin_clients("ironic").node.delete = mock_node_delete
        scenario = utils.IronicScenario(self.context)
        scenario._delete_node("fake_id")

        self.admin_clients("ironic").node.delete.assert_called_once_with(
            "fake_id")
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "ironic.delete_node")
Ejemplo n.º 2
0
    def test__create_node(self, mock_generate_random_name):
        mock_generate_random_name.return_value = "rally_fake_random_string"
        self.admin_clients("ironic").node.create.return_value = "fake_node"
        scenario = utils.IronicScenario()
        create_node = scenario._create_node(fake_param="foo")

        self.assertEqual("fake_node", create_node)
        self.admin_clients("ironic").node.create.assert_called_once_with(
            fake_param="foo", name="rally_fake_random_string")
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "ironic.create_node")
Ejemplo n.º 3
0
    def test__create_node(self, mock_wait_for_status):
        self.admin_clients("ironic").node.create.return_value = "fake_node"
        scenario = utils.IronicScenario(self.context)
        scenario.generate_random_name = mock.Mock()

        scenario._create_node(driver="fake",
                              properties="fake_prop",
                              fake_param="foo")

        self.admin_clients("ironic").node.create.assert_called_once_with(
            driver="fake",
            properties="fake_prop",
            fake_param="foo",
            name=scenario.generate_random_name.return_value)
        self.assertTrue(mock_wait_for_status.called)
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "ironic.create_node")
Ejemplo n.º 4
0
 def test__list_nodes(self):
     self.admin_clients("ironic").node.list.return_value = ["fake"]
     scenario = utils.IronicScenario(self.context)
     fake_params = {
         "sort_dir": "foo1",
         "associated": "foo2",
         "detail": True,
         "maintenance": "foo5"
     }
     return_nodes_list = scenario._list_nodes(**fake_params)
     self.assertEqual(["fake"], return_nodes_list)
     self.admin_clients("ironic").node.list.assert_called_once_with(
         sort_dir="foo1",
         associated="foo2",
         detail=True,
         maintenance="foo5")
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "ironic.list_nodes")