Exemplo n.º 1
0
    def test_node_get_by_physical_id(self):
        shared.create_node(self.ctx, self.cluster, self.profile,
                           physical_id=UUID1)

        node = db_api.node_get_by_physical_id(self.ctx, UUID1)
        self.assertIsNotNone(node)
        self.assertEqual(UUID1, node.physical_id)

        node = db_api.node_get_by_physical_id(self.ctx, UUID2)
        self.assertIsNone(node)
Exemplo n.º 2
0
    def test_node_get_by_physical_id(self):
        shared.create_node(self.ctx, self.cluster, self.profile,
                           physical_id=UUID1)

        node = db_api.node_get_by_physical_id(self.ctx, UUID1)
        self.assertIsNotNone(node)
        self.assertEqual(UUID1, node.physical_id)

        node = db_api.node_get_by_physical_id(self.ctx, UUID2)
        self.assertIsNone(node)
Exemplo n.º 3
0
    def test_node_get_by_physical_id_diff_project(self):
        shared.create_node(self.ctx, self.cluster, self.profile,
                           physical_id=UUID1)

        node = db_api.node_get_by_physical_id(self.ctx, UUID1)
        self.assertIsNotNone(node)
        self.assertEqual(UUID1, node.physical_id)

        ctx_new = utils.dummy_context(project='a_different_project')
        node = db_api.node_get_by_physical_id(ctx_new, UUID1)
        self.assertIsNone(node)
        node = db_api.node_get_by_physical_id(ctx_new, UUID1,
                                              project_safe=False)
        self.assertIsNotNone(node)