root / test / py / ganeti.hypervisor.hv_lxc_unittest.py @ d01e51a5
History | View | Annotate | Download (1.4 kB)
1 | 55cc0a44 | Michael Hanselmann | #!/usr/bin/python
|
---|---|---|---|
2 | 55cc0a44 | Michael Hanselmann | #
|
3 | 55cc0a44 | Michael Hanselmann | |
4 | 55cc0a44 | Michael Hanselmann | # Copyright (C) 2011 Google Inc.
|
5 | 55cc0a44 | Michael Hanselmann | #
|
6 | 55cc0a44 | Michael Hanselmann | # This program is free software; you can redistribute it and/or modify
|
7 | 55cc0a44 | Michael Hanselmann | # it under the terms of the GNU General Public License as published by
|
8 | 55cc0a44 | Michael Hanselmann | # the Free Software Foundation; either version 2 of the License, or
|
9 | 55cc0a44 | Michael Hanselmann | # (at your option) any later version.
|
10 | 55cc0a44 | Michael Hanselmann | #
|
11 | 55cc0a44 | Michael Hanselmann | # This program is distributed in the hope that it will be useful, but
|
12 | 55cc0a44 | Michael Hanselmann | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 55cc0a44 | Michael Hanselmann | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 55cc0a44 | Michael Hanselmann | # General Public License for more details.
|
15 | 55cc0a44 | Michael Hanselmann | #
|
16 | 55cc0a44 | Michael Hanselmann | # You should have received a copy of the GNU General Public License
|
17 | 55cc0a44 | Michael Hanselmann | # along with this program; if not, write to the Free Software
|
18 | 55cc0a44 | Michael Hanselmann | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | 55cc0a44 | Michael Hanselmann | # 02110-1301, USA.
|
20 | 55cc0a44 | Michael Hanselmann | |
21 | 55cc0a44 | Michael Hanselmann | |
22 | 55cc0a44 | Michael Hanselmann | """Script for testing ganeti.hypervisor.hv_lxc"""
|
23 | 55cc0a44 | Michael Hanselmann | |
24 | 55cc0a44 | Michael Hanselmann | import unittest |
25 | 55cc0a44 | Michael Hanselmann | |
26 | 55cc0a44 | Michael Hanselmann | from ganeti import constants |
27 | 55cc0a44 | Michael Hanselmann | from ganeti import objects |
28 | 55cc0a44 | Michael Hanselmann | from ganeti import hypervisor |
29 | 55cc0a44 | Michael Hanselmann | |
30 | 55cc0a44 | Michael Hanselmann | from ganeti.hypervisor import hv_lxc |
31 | 55cc0a44 | Michael Hanselmann | |
32 | 55cc0a44 | Michael Hanselmann | import testutils |
33 | 55cc0a44 | Michael Hanselmann | |
34 | 55cc0a44 | Michael Hanselmann | |
35 | 55cc0a44 | Michael Hanselmann | class TestConsole(unittest.TestCase): |
36 | 55cc0a44 | Michael Hanselmann | def test(self): |
37 | 55cc0a44 | Michael Hanselmann | instance = objects.Instance(name="lxc.example.com", primary_node="node199") |
38 | 55cc0a44 | Michael Hanselmann | cons = hv_lxc.LXCHypervisor.GetInstanceConsole(instance, {}, {}) |
39 | 55cc0a44 | Michael Hanselmann | self.assertTrue(cons.Validate())
|
40 | 55cc0a44 | Michael Hanselmann | self.assertEqual(cons.kind, constants.CONS_SSH)
|
41 | 55cc0a44 | Michael Hanselmann | self.assertEqual(cons.host, instance.primary_node)
|
42 | 55cc0a44 | Michael Hanselmann | self.assertEqual(cons.command[-1], instance.name) |
43 | 55cc0a44 | Michael Hanselmann | |
44 | 55cc0a44 | Michael Hanselmann | |
45 | 55cc0a44 | Michael Hanselmann | if __name__ == "__main__": |
46 | 55cc0a44 | Michael Hanselmann | testutils.GanetiTestProgram() |