root / test / cfgupgrade_unittest.py @ 08f8c82c
History | View | Annotate | Download (11.4 kB)
1 | aefbe369 | Michael Hanselmann | #!/usr/bin/python
|
---|---|---|---|
2 | aefbe369 | Michael Hanselmann | #
|
3 | aefbe369 | Michael Hanselmann | |
4 | aefbe369 | Michael Hanselmann | # Copyright (C) 2010 Google Inc.
|
5 | aefbe369 | Michael Hanselmann | #
|
6 | aefbe369 | Michael Hanselmann | # This program is free software; you can redistribute it and/or modify
|
7 | aefbe369 | Michael Hanselmann | # it under the terms of the GNU General Public License as published by
|
8 | aefbe369 | Michael Hanselmann | # the Free Software Foundation; either version 2 of the License, or
|
9 | aefbe369 | Michael Hanselmann | # (at your option) any later version.
|
10 | aefbe369 | Michael Hanselmann | #
|
11 | aefbe369 | Michael Hanselmann | # This program is distributed in the hope that it will be useful, but
|
12 | aefbe369 | Michael Hanselmann | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | aefbe369 | Michael Hanselmann | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | aefbe369 | Michael Hanselmann | # General Public License for more details.
|
15 | aefbe369 | Michael Hanselmann | #
|
16 | aefbe369 | Michael Hanselmann | # You should have received a copy of the GNU General Public License
|
17 | aefbe369 | Michael Hanselmann | # along with this program; if not, write to the Free Software
|
18 | aefbe369 | Michael Hanselmann | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | aefbe369 | Michael Hanselmann | # 02110-1301, USA.
|
20 | aefbe369 | Michael Hanselmann | |
21 | aefbe369 | Michael Hanselmann | |
22 | aefbe369 | Michael Hanselmann | """Script for testing tools/cfgupgrade"""
|
23 | aefbe369 | Michael Hanselmann | |
24 | aefbe369 | Michael Hanselmann | import os |
25 | aefbe369 | Michael Hanselmann | import sys |
26 | aefbe369 | Michael Hanselmann | import unittest |
27 | aefbe369 | Michael Hanselmann | import shutil |
28 | aefbe369 | Michael Hanselmann | import tempfile |
29 | aefbe369 | Michael Hanselmann | import operator |
30 | aefbe369 | Michael Hanselmann | |
31 | aefbe369 | Michael Hanselmann | from ganeti import constants |
32 | aefbe369 | Michael Hanselmann | from ganeti import utils |
33 | aefbe369 | Michael Hanselmann | from ganeti import errors |
34 | aefbe369 | Michael Hanselmann | from ganeti import serializer |
35 | 011974df | Michael Hanselmann | from ganeti import netutils |
36 | aefbe369 | Michael Hanselmann | |
37 | aefbe369 | Michael Hanselmann | import testutils |
38 | aefbe369 | Michael Hanselmann | |
39 | aefbe369 | Michael Hanselmann | |
40 | 011974df | Michael Hanselmann | def _RunUpgrade(path, dry_run, no_verify, ignore_hostname=True): |
41 | aefbe369 | Michael Hanselmann | cmd = [sys.executable, "%s/tools/cfgupgrade" % testutils.GetSourceDir(),
|
42 | aefbe369 | Michael Hanselmann | "--debug", "--force", "--path=%s" % path] |
43 | 011974df | Michael Hanselmann | |
44 | 011974df | Michael Hanselmann | if ignore_hostname:
|
45 | 011974df | Michael Hanselmann | cmd.append("--ignore-hostname")
|
46 | aefbe369 | Michael Hanselmann | if dry_run:
|
47 | aefbe369 | Michael Hanselmann | cmd.append("--dry-run")
|
48 | aefbe369 | Michael Hanselmann | if no_verify:
|
49 | aefbe369 | Michael Hanselmann | cmd.append("--no-verify")
|
50 | aefbe369 | Michael Hanselmann | |
51 | aefbe369 | Michael Hanselmann | result = utils.RunCmd(cmd, cwd=os.getcwd()) |
52 | aefbe369 | Michael Hanselmann | if result.failed:
|
53 | aefbe369 | Michael Hanselmann | raise Exception("cfgupgrade failed: %s, output %r" % |
54 | aefbe369 | Michael Hanselmann | (result.fail_reason, result.output)) |
55 | aefbe369 | Michael Hanselmann | |
56 | aefbe369 | Michael Hanselmann | |
57 | aefbe369 | Michael Hanselmann | class TestCfgupgrade(unittest.TestCase): |
58 | aefbe369 | Michael Hanselmann | def setUp(self): |
59 | aefbe369 | Michael Hanselmann | self.tmpdir = tempfile.mkdtemp()
|
60 | aefbe369 | Michael Hanselmann | |
61 | aefbe369 | Michael Hanselmann | self.config_path = utils.PathJoin(self.tmpdir, "config.data") |
62 | aefbe369 | Michael Hanselmann | self.noded_cert_path = utils.PathJoin(self.tmpdir, "server.pem") |
63 | aefbe369 | Michael Hanselmann | self.rapi_cert_path = utils.PathJoin(self.tmpdir, "rapi.pem") |
64 | fdd9ac5b | Michael Hanselmann | self.rapi_users_path = utils.PathJoin(self.tmpdir, "rapi", "users") |
65 | fdd9ac5b | Michael Hanselmann | self.rapi_users_path_pre24 = utils.PathJoin(self.tmpdir, "rapi_users") |
66 | aefbe369 | Michael Hanselmann | self.known_hosts_path = utils.PathJoin(self.tmpdir, "known_hosts") |
67 | aefbe369 | Michael Hanselmann | self.confd_hmac_path = utils.PathJoin(self.tmpdir, "hmac.key") |
68 | aefbe369 | Michael Hanselmann | self.cds_path = utils.PathJoin(self.tmpdir, "cluster-domain-secret") |
69 | 011974df | Michael Hanselmann | self.ss_master_node_path = utils.PathJoin(self.tmpdir, "ssconf_master_node") |
70 | aefbe369 | Michael Hanselmann | |
71 | aefbe369 | Michael Hanselmann | def tearDown(self): |
72 | aefbe369 | Michael Hanselmann | shutil.rmtree(self.tmpdir)
|
73 | aefbe369 | Michael Hanselmann | |
74 | aefbe369 | Michael Hanselmann | def _LoadConfig(self): |
75 | aefbe369 | Michael Hanselmann | return serializer.LoadJson(utils.ReadFile(self.config_path)) |
76 | aefbe369 | Michael Hanselmann | |
77 | aefbe369 | Michael Hanselmann | def _CreateValidConfigDir(self): |
78 | aefbe369 | Michael Hanselmann | utils.WriteFile(self.noded_cert_path, data="") |
79 | aefbe369 | Michael Hanselmann | utils.WriteFile(self.known_hosts_path, data="") |
80 | 011974df | Michael Hanselmann | utils.WriteFile(self.ss_master_node_path,
|
81 | 011974df | Michael Hanselmann | data="node.has.another.name.example.net")
|
82 | aefbe369 | Michael Hanselmann | |
83 | aefbe369 | Michael Hanselmann | def testNoConfigDir(self): |
84 | aefbe369 | Michael Hanselmann | self.assertFalse(utils.ListVisibleFiles(self.tmpdir)) |
85 | aefbe369 | Michael Hanselmann | self.assertRaises(Exception, _RunUpgrade, self.tmpdir, False, True) |
86 | aefbe369 | Michael Hanselmann | self.assertRaises(Exception, _RunUpgrade, self.tmpdir, True, True) |
87 | aefbe369 | Michael Hanselmann | |
88 | 011974df | Michael Hanselmann | def testWrongHostname(self): |
89 | 011974df | Michael Hanselmann | self._CreateValidConfigDir()
|
90 | 011974df | Michael Hanselmann | |
91 | 011974df | Michael Hanselmann | utils.WriteFile(self.config_path, data=serializer.DumpJson({
|
92 | 011974df | Michael Hanselmann | "version": constants.CONFIG_VERSION,
|
93 | 011974df | Michael Hanselmann | "cluster": {},
|
94 | 011974df | Michael Hanselmann | })) |
95 | 011974df | Michael Hanselmann | |
96 | 011974df | Michael Hanselmann | hostname = netutils.GetHostname().name |
97 | 011974df | Michael Hanselmann | assert hostname != utils.ReadOneLineFile(self.ss_master_node_path) |
98 | 011974df | Michael Hanselmann | |
99 | 011974df | Michael Hanselmann | self.assertRaises(Exception, _RunUpgrade, self.tmpdir, False, True, |
100 | 011974df | Michael Hanselmann | ignore_hostname=False)
|
101 | 011974df | Michael Hanselmann | |
102 | 011974df | Michael Hanselmann | def testCorrectHostname(self): |
103 | 011974df | Michael Hanselmann | self._CreateValidConfigDir()
|
104 | 011974df | Michael Hanselmann | |
105 | 011974df | Michael Hanselmann | utils.WriteFile(self.config_path, data=serializer.DumpJson({
|
106 | 011974df | Michael Hanselmann | "version": constants.CONFIG_VERSION,
|
107 | 011974df | Michael Hanselmann | "cluster": {},
|
108 | 011974df | Michael Hanselmann | })) |
109 | 011974df | Michael Hanselmann | |
110 | 011974df | Michael Hanselmann | utils.WriteFile(self.ss_master_node_path,
|
111 | 011974df | Michael Hanselmann | data="%s\n" % netutils.GetHostname().name)
|
112 | 011974df | Michael Hanselmann | |
113 | 011974df | Michael Hanselmann | _RunUpgrade(self.tmpdir, False, True, ignore_hostname=False) |
114 | 011974df | Michael Hanselmann | |
115 | aefbe369 | Michael Hanselmann | def testInconsistentConfig(self): |
116 | aefbe369 | Michael Hanselmann | self._CreateValidConfigDir()
|
117 | aefbe369 | Michael Hanselmann | # There should be no "config_version"
|
118 | aefbe369 | Michael Hanselmann | cfg = { |
119 | aefbe369 | Michael Hanselmann | "version": 0, |
120 | aefbe369 | Michael Hanselmann | "cluster": {
|
121 | aefbe369 | Michael Hanselmann | "config_version": 0, |
122 | aefbe369 | Michael Hanselmann | }, |
123 | aefbe369 | Michael Hanselmann | } |
124 | aefbe369 | Michael Hanselmann | utils.WriteFile(self.config_path, data=serializer.DumpJson(cfg))
|
125 | aefbe369 | Michael Hanselmann | self.assertRaises(Exception, _RunUpgrade, self.tmpdir, False, True) |
126 | aefbe369 | Michael Hanselmann | |
127 | aefbe369 | Michael Hanselmann | def testInvalidConfig(self): |
128 | aefbe369 | Michael Hanselmann | self._CreateValidConfigDir()
|
129 | aefbe369 | Michael Hanselmann | # Missing version from config
|
130 | aefbe369 | Michael Hanselmann | utils.WriteFile(self.config_path, data=serializer.DumpJson({}))
|
131 | aefbe369 | Michael Hanselmann | self.assertRaises(Exception, _RunUpgrade, self.tmpdir, False, True) |
132 | aefbe369 | Michael Hanselmann | |
133 | aefbe369 | Michael Hanselmann | def _TestSimpleUpgrade(self, from_version, dry_run): |
134 | aefbe369 | Michael Hanselmann | cfg = { |
135 | aefbe369 | Michael Hanselmann | "version": from_version,
|
136 | aefbe369 | Michael Hanselmann | "cluster": {},
|
137 | aefbe369 | Michael Hanselmann | } |
138 | aefbe369 | Michael Hanselmann | self._CreateValidConfigDir()
|
139 | aefbe369 | Michael Hanselmann | utils.WriteFile(self.config_path, data=serializer.DumpJson(cfg))
|
140 | aefbe369 | Michael Hanselmann | |
141 | aefbe369 | Michael Hanselmann | self.assertFalse(os.path.isfile(self.rapi_cert_path)) |
142 | aefbe369 | Michael Hanselmann | self.assertFalse(os.path.isfile(self.confd_hmac_path)) |
143 | aefbe369 | Michael Hanselmann | self.assertFalse(os.path.isfile(self.cds_path)) |
144 | aefbe369 | Michael Hanselmann | |
145 | aefbe369 | Michael Hanselmann | _RunUpgrade(self.tmpdir, dry_run, True) |
146 | aefbe369 | Michael Hanselmann | |
147 | aefbe369 | Michael Hanselmann | if dry_run:
|
148 | aefbe369 | Michael Hanselmann | expversion = from_version |
149 | aefbe369 | Michael Hanselmann | checkfn = operator.not_ |
150 | aefbe369 | Michael Hanselmann | else:
|
151 | aefbe369 | Michael Hanselmann | expversion = constants.CONFIG_VERSION |
152 | aefbe369 | Michael Hanselmann | checkfn = operator.truth |
153 | aefbe369 | Michael Hanselmann | |
154 | aefbe369 | Michael Hanselmann | self.assert_(checkfn(os.path.isfile(self.rapi_cert_path))) |
155 | aefbe369 | Michael Hanselmann | self.assert_(checkfn(os.path.isfile(self.confd_hmac_path))) |
156 | aefbe369 | Michael Hanselmann | self.assert_(checkfn(os.path.isfile(self.cds_path))) |
157 | aefbe369 | Michael Hanselmann | |
158 | aefbe369 | Michael Hanselmann | newcfg = self._LoadConfig()
|
159 | aefbe369 | Michael Hanselmann | self.assertEqual(newcfg["version"], expversion) |
160 | aefbe369 | Michael Hanselmann | |
161 | fdd9ac5b | Michael Hanselmann | def testRapiUsers(self): |
162 | fdd9ac5b | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
163 | fdd9ac5b | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
164 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(os.path.dirname(self.rapi_users_path))) |
165 | fdd9ac5b | Michael Hanselmann | |
166 | fdd9ac5b | Michael Hanselmann | utils.WriteFile(self.rapi_users_path_pre24, data="some user\n") |
167 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 3, 0), False) |
168 | fdd9ac5b | Michael Hanselmann | |
169 | 87c80992 | Michael Hanselmann | self.assertTrue(os.path.isdir(os.path.dirname(self.rapi_users_path))) |
170 | fdd9ac5b | Michael Hanselmann | self.assert_(os.path.islink(self.rapi_users_path_pre24)) |
171 | fdd9ac5b | Michael Hanselmann | self.assert_(os.path.isfile(self.rapi_users_path)) |
172 | 87c80992 | Michael Hanselmann | self.assertEqual(os.readlink(self.rapi_users_path_pre24), |
173 | 87c80992 | Michael Hanselmann | self.rapi_users_path)
|
174 | fdd9ac5b | Michael Hanselmann | for path in [self.rapi_users_path, self.rapi_users_path_pre24]: |
175 | fdd9ac5b | Michael Hanselmann | self.assertEqual(utils.ReadFile(path), "some user\n") |
176 | fdd9ac5b | Michael Hanselmann | |
177 | fdd9ac5b | Michael Hanselmann | def testRapiUsers24AndAbove(self): |
178 | fdd9ac5b | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
179 | fdd9ac5b | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
180 | fdd9ac5b | Michael Hanselmann | |
181 | fdd9ac5b | Michael Hanselmann | os.mkdir(os.path.dirname(self.rapi_users_path))
|
182 | fdd9ac5b | Michael Hanselmann | utils.WriteFile(self.rapi_users_path, data="other user\n") |
183 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 3, 0), False) |
184 | fdd9ac5b | Michael Hanselmann | |
185 | fdd9ac5b | Michael Hanselmann | self.assert_(os.path.islink(self.rapi_users_path_pre24)) |
186 | fdd9ac5b | Michael Hanselmann | self.assert_(os.path.isfile(self.rapi_users_path)) |
187 | 87c80992 | Michael Hanselmann | self.assertEqual(os.readlink(self.rapi_users_path_pre24), |
188 | 87c80992 | Michael Hanselmann | self.rapi_users_path)
|
189 | fdd9ac5b | Michael Hanselmann | for path in [self.rapi_users_path, self.rapi_users_path_pre24]: |
190 | fdd9ac5b | Michael Hanselmann | self.assertEqual(utils.ReadFile(path), "other user\n") |
191 | fdd9ac5b | Michael Hanselmann | |
192 | fdd9ac5b | Michael Hanselmann | def testRapiUsersExistingSymlink(self): |
193 | fdd9ac5b | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
194 | fdd9ac5b | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
195 | fdd9ac5b | Michael Hanselmann | |
196 | 87c80992 | Michael Hanselmann | os.mkdir(os.path.dirname(self.rapi_users_path))
|
197 | fdd9ac5b | Michael Hanselmann | os.symlink(self.rapi_users_path, self.rapi_users_path_pre24) |
198 | 87c80992 | Michael Hanselmann | utils.WriteFile(self.rapi_users_path, data="hello world\n") |
199 | fdd9ac5b | Michael Hanselmann | |
200 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 2, 0), False) |
201 | fdd9ac5b | Michael Hanselmann | |
202 | 87c80992 | Michael Hanselmann | self.assert_(os.path.isfile(self.rapi_users_path) and |
203 | 87c80992 | Michael Hanselmann | not os.path.islink(self.rapi_users_path)) |
204 | fdd9ac5b | Michael Hanselmann | self.assert_(os.path.islink(self.rapi_users_path_pre24)) |
205 | 87c80992 | Michael Hanselmann | self.assertEqual(os.readlink(self.rapi_users_path_pre24), |
206 | 87c80992 | Michael Hanselmann | self.rapi_users_path)
|
207 | 87c80992 | Michael Hanselmann | for path in [self.rapi_users_path, self.rapi_users_path_pre24]: |
208 | 87c80992 | Michael Hanselmann | self.assertEqual(utils.ReadFile(path), "hello world\n") |
209 | 87c80992 | Michael Hanselmann | |
210 | 87c80992 | Michael Hanselmann | def testRapiUsersExistingTarget(self): |
211 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
212 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
213 | 87c80992 | Michael Hanselmann | |
214 | 87c80992 | Michael Hanselmann | os.mkdir(os.path.dirname(self.rapi_users_path))
|
215 | 87c80992 | Michael Hanselmann | utils.WriteFile(self.rapi_users_path, data="other user\n") |
216 | 87c80992 | Michael Hanselmann | utils.WriteFile(self.rapi_users_path_pre24, data="hello world\n") |
217 | 87c80992 | Michael Hanselmann | |
218 | 87c80992 | Michael Hanselmann | self.assertRaises(Exception, self._TestSimpleUpgrade, |
219 | 87c80992 | Michael Hanselmann | constants.BuildVersion(2, 2, 0), False) |
220 | 87c80992 | Michael Hanselmann | |
221 | 87c80992 | Michael Hanselmann | for path in [self.rapi_users_path, self.rapi_users_path_pre24]: |
222 | 87c80992 | Michael Hanselmann | self.assert_(os.path.isfile(path) and not os.path.islink(path)) |
223 | 87c80992 | Michael Hanselmann | self.assertEqual(utils.ReadFile(self.rapi_users_path), "other user\n") |
224 | 87c80992 | Michael Hanselmann | self.assertEqual(utils.ReadFile(self.rapi_users_path_pre24), |
225 | 87c80992 | Michael Hanselmann | "hello world\n")
|
226 | 87c80992 | Michael Hanselmann | |
227 | 87c80992 | Michael Hanselmann | def testRapiUsersDryRun(self): |
228 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
229 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
230 | 87c80992 | Michael Hanselmann | |
231 | 87c80992 | Michael Hanselmann | utils.WriteFile(self.rapi_users_path_pre24, data="some user\n") |
232 | 87c80992 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 3, 0), True) |
233 | 87c80992 | Michael Hanselmann | |
234 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.isdir(os.path.dirname(self.rapi_users_path))) |
235 | 87c80992 | Michael Hanselmann | self.assertTrue(os.path.isfile(self.rapi_users_path_pre24) and |
236 | 87c80992 | Michael Hanselmann | not os.path.islink(self.rapi_users_path_pre24)) |
237 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
238 | 87c80992 | Michael Hanselmann | |
239 | 87c80992 | Michael Hanselmann | def testRapiUsers24AndAboveDryRun(self): |
240 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
241 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
242 | 87c80992 | Michael Hanselmann | |
243 | 87c80992 | Michael Hanselmann | os.mkdir(os.path.dirname(self.rapi_users_path))
|
244 | 87c80992 | Michael Hanselmann | utils.WriteFile(self.rapi_users_path, data="other user\n") |
245 | 87c80992 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 3, 0), True) |
246 | 87c80992 | Michael Hanselmann | |
247 | 87c80992 | Michael Hanselmann | self.assertTrue(os.path.isfile(self.rapi_users_path) and |
248 | 87c80992 | Michael Hanselmann | not os.path.islink(self.rapi_users_path)) |
249 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
250 | 87c80992 | Michael Hanselmann | self.assertEqual(utils.ReadFile(self.rapi_users_path), "other user\n") |
251 | 87c80992 | Michael Hanselmann | |
252 | 87c80992 | Michael Hanselmann | def testRapiUsersExistingSymlinkDryRun(self): |
253 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path)) |
254 | 87c80992 | Michael Hanselmann | self.assertFalse(os.path.exists(self.rapi_users_path_pre24)) |
255 | 87c80992 | Michael Hanselmann | |
256 | 87c80992 | Michael Hanselmann | os.mkdir(os.path.dirname(self.rapi_users_path))
|
257 | 87c80992 | Michael Hanselmann | os.symlink(self.rapi_users_path, self.rapi_users_path_pre24) |
258 | 87c80992 | Michael Hanselmann | utils.WriteFile(self.rapi_users_path, data="hello world\n") |
259 | 87c80992 | Michael Hanselmann | |
260 | 87c80992 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 2, 0), True) |
261 | 87c80992 | Michael Hanselmann | |
262 | 87c80992 | Michael Hanselmann | self.assertTrue(os.path.islink(self.rapi_users_path_pre24)) |
263 | 87c80992 | Michael Hanselmann | self.assertTrue(os.path.isfile(self.rapi_users_path) and |
264 | 87c80992 | Michael Hanselmann | not os.path.islink(self.rapi_users_path)) |
265 | 87c80992 | Michael Hanselmann | self.assertEqual(os.readlink(self.rapi_users_path_pre24), |
266 | 87c80992 | Michael Hanselmann | self.rapi_users_path)
|
267 | fdd9ac5b | Michael Hanselmann | for path in [self.rapi_users_path, self.rapi_users_path_pre24]: |
268 | fdd9ac5b | Michael Hanselmann | self.assertEqual(utils.ReadFile(path), "hello world\n") |
269 | fdd9ac5b | Michael Hanselmann | |
270 | aefbe369 | Michael Hanselmann | def testUpgradeFrom_2_0(self): |
271 | aefbe369 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 0, 0), False) |
272 | aefbe369 | Michael Hanselmann | |
273 | aefbe369 | Michael Hanselmann | def testUpgradeFrom_2_1(self): |
274 | aefbe369 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 1, 0), False) |
275 | aefbe369 | Michael Hanselmann | |
276 | fdd9ac5b | Michael Hanselmann | def testUpgradeFrom_2_2(self): |
277 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 2, 0), False) |
278 | fdd9ac5b | Michael Hanselmann | |
279 | fdd9ac5b | Michael Hanselmann | def testUpgradeFrom_2_3(self): |
280 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 3, 0), False) |
281 | fdd9ac5b | Michael Hanselmann | |
282 | a91f69c4 | Michael Hanselmann | def testUpgradeFrom_2_4(self): |
283 | a91f69c4 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 4, 0), False) |
284 | a91f69c4 | Michael Hanselmann | |
285 | aefbe369 | Michael Hanselmann | def testUpgradeCurrent(self): |
286 | aefbe369 | Michael Hanselmann | self._TestSimpleUpgrade(constants.CONFIG_VERSION, False) |
287 | aefbe369 | Michael Hanselmann | |
288 | aefbe369 | Michael Hanselmann | def testUpgradeDryRunFrom_2_0(self): |
289 | aefbe369 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 0, 0), True) |
290 | aefbe369 | Michael Hanselmann | |
291 | aefbe369 | Michael Hanselmann | def testUpgradeDryRunFrom_2_1(self): |
292 | aefbe369 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 1, 0), True) |
293 | aefbe369 | Michael Hanselmann | |
294 | fdd9ac5b | Michael Hanselmann | def testUpgradeDryRunFrom_2_2(self): |
295 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 2, 0), True) |
296 | fdd9ac5b | Michael Hanselmann | |
297 | fdd9ac5b | Michael Hanselmann | def testUpgradeDryRunFrom_2_3(self): |
298 | fdd9ac5b | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 3, 0), True) |
299 | fdd9ac5b | Michael Hanselmann | |
300 | a91f69c4 | Michael Hanselmann | def testUpgradeDryRunFrom_2_4(self): |
301 | a91f69c4 | Michael Hanselmann | self._TestSimpleUpgrade(constants.BuildVersion(2, 4, 0), True) |
302 | a91f69c4 | Michael Hanselmann | |
303 | aefbe369 | Michael Hanselmann | def testUpgradeCurrentDryRun(self): |
304 | aefbe369 | Michael Hanselmann | self._TestSimpleUpgrade(constants.CONFIG_VERSION, True) |
305 | aefbe369 | Michael Hanselmann | |
306 | aefbe369 | Michael Hanselmann | |
307 | aefbe369 | Michael Hanselmann | if __name__ == "__main__": |
308 | aefbe369 | Michael Hanselmann | testutils.GanetiTestProgram() |