~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/tests/test_libvirt_config.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-06-22 12:39:57 UTC
  • mfrom: (1.1.57)
  • Revision ID: package-import@ubuntu.com-20120622123957-hbzwg84nt9rqwg8r
Tags: 2012.2~f2~20120621.14517-0ubuntu1
[ Chuck Short ]
* New upstream version.

[ Adam Gandelman ]
* debian/rules: Temporarily disable test suite while blocking
  tests are investigated. 
* debian/patches/kombu_tests_timeout.patch: Dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
        xml = etree.tostring(root)
54
54
        self.assertXmlEqual(xml, "<demo><foo>bar</foo></demo>")
55
55
 
 
56
    def test_config_parse(self):
 
57
        inxml = "<demo><foo/></demo>"
 
58
        obj = config.LibvirtConfigObject(root_name="demo")
 
59
        obj.parse_str(inxml)
 
60
 
 
61
 
 
62
class LibvirtConfigGuestTimerTest(LibvirtConfigBaseTest):
 
63
    def test_config_platform(self):
 
64
        obj = config.LibvirtConfigGuestTimer()
 
65
        obj.track = "host"
 
66
 
 
67
        xml = obj.to_xml()
 
68
        self.assertXmlEqual(xml, """
 
69
            <timer name="platform" track="host"/>
 
70
        """)
 
71
 
 
72
    def test_config_pit(self):
 
73
        obj = config.LibvirtConfigGuestTimer()
 
74
        obj.name = "pit"
 
75
        obj.tickpolicy = "discard"
 
76
 
 
77
        xml = obj.to_xml()
 
78
        self.assertXmlEqual(xml, """
 
79
            <timer name="pit" tickpolicy="discard"/>
 
80
        """)
 
81
 
 
82
    def test_config_hpet(self):
 
83
        obj = config.LibvirtConfigGuestTimer()
 
84
        obj.name = "hpet"
 
85
        obj.present = False
 
86
 
 
87
        xml = obj.to_xml()
 
88
        self.assertXmlEqual(xml, """
 
89
            <timer name="hpet" present="no"/>
 
90
        """)
 
91
 
 
92
 
 
93
class LibvirtConfigGuestClockTest(LibvirtConfigBaseTest):
 
94
    def test_config_utc(self):
 
95
        obj = config.LibvirtConfigGuestClock()
 
96
 
 
97
        xml = obj.to_xml()
 
98
        self.assertXmlEqual(xml, """
 
99
            <clock offset="utc"/>
 
100
        """)
 
101
 
 
102
    def test_config_localtime(self):
 
103
        obj = config.LibvirtConfigGuestClock()
 
104
        obj.offset = "localtime"
 
105
 
 
106
        xml = obj.to_xml()
 
107
        self.assertXmlEqual(xml, """
 
108
            <clock offset="localtime"/>
 
109
        """)
 
110
 
 
111
    def test_config_timezone(self):
 
112
        obj = config.LibvirtConfigGuestClock()
 
113
        obj.offset = "timezone"
 
114
        obj.timezone = "EDT"
 
115
 
 
116
        xml = obj.to_xml()
 
117
        self.assertXmlEqual(xml, """
 
118
            <clock offset="timezone" timezone="EDT"/>
 
119
        """)
 
120
 
 
121
    def test_config_variable(self):
 
122
        obj = config.LibvirtConfigGuestClock()
 
123
        obj.offset = "variable"
 
124
        obj.adjustment = "123456"
 
125
 
 
126
        xml = obj.to_xml()
 
127
        self.assertXmlEqual(xml, """
 
128
            <clock offset="variable" adjustment="123456"/>
 
129
        """)
 
130
 
 
131
    def test_config_timers(self):
 
132
        obj = config.LibvirtConfigGuestClock()
 
133
 
 
134
        tmpit = config.LibvirtConfigGuestTimer()
 
135
        tmpit.name = "pit"
 
136
        tmpit.tickpolicy = "discard"
 
137
 
 
138
        tmrtc = config.LibvirtConfigGuestTimer()
 
139
        tmrtc.name = "rtc"
 
140
        tmrtc.tickpolicy = "merge"
 
141
 
 
142
        obj.add_timer(tmpit)
 
143
        obj.add_timer(tmrtc)
 
144
 
 
145
        xml = obj.to_xml()
 
146
        self.assertXmlEqual(xml, """
 
147
            <clock offset="utc">
 
148
               <timer name="pit" tickpolicy="discard"/>
 
149
               <timer name="rtc" tickpolicy="merge"/>
 
150
            </clock>
 
151
        """)
 
152
 
56
153
 
57
154
class LibvirtConfigGuestDiskTest(LibvirtConfigBaseTest):
58
155