root / test / py / ganeti.storage.filestorage_unittest.py @ 5d94c034
History | View | Annotate | Download (1.4 kB)
1 | 820bade9 | Helga Velroyen | #!/usr/bin/python
|
---|---|---|---|
2 | 820bade9 | Helga Velroyen | #
|
3 | 820bade9 | Helga Velroyen | |
4 | 820bade9 | Helga Velroyen | # Copyright (C) 2013 Google Inc.
|
5 | 820bade9 | Helga Velroyen | #
|
6 | 820bade9 | Helga Velroyen | # This program is free software; you can redistribute it and/or modify
|
7 | 820bade9 | Helga Velroyen | # it under the terms of the GNU General Public License as published by
|
8 | 820bade9 | Helga Velroyen | # the Free Software Foundation; either version 2 of the License, or
|
9 | 820bade9 | Helga Velroyen | # (at your option) any later version.
|
10 | 820bade9 | Helga Velroyen | #
|
11 | 820bade9 | Helga Velroyen | # This program is distributed in the hope that it will be useful, but
|
12 | 820bade9 | Helga Velroyen | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 820bade9 | Helga Velroyen | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 820bade9 | Helga Velroyen | # General Public License for more details.
|
15 | 820bade9 | Helga Velroyen | #
|
16 | 820bade9 | Helga Velroyen | # You should have received a copy of the GNU General Public License
|
17 | 820bade9 | Helga Velroyen | # along with this program; if not, write to the Free Software
|
18 | 820bade9 | Helga Velroyen | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | 820bade9 | Helga Velroyen | # 02110-1301, USA.
|
20 | 820bade9 | Helga Velroyen | |
21 | 820bade9 | Helga Velroyen | |
22 | 820bade9 | Helga Velroyen | """Script for unittesting the ganeti.storage.file module"""
|
23 | 820bade9 | Helga Velroyen | |
24 | 820bade9 | Helga Velroyen | |
25 | 820bade9 | Helga Velroyen | import unittest |
26 | 820bade9 | Helga Velroyen | |
27 | 820bade9 | Helga Velroyen | from ganeti import errors |
28 | 820bade9 | Helga Velroyen | from ganeti.storage import filestorage |
29 | 820bade9 | Helga Velroyen | |
30 | 820bade9 | Helga Velroyen | import testutils |
31 | 820bade9 | Helga Velroyen | |
32 | 820bade9 | Helga Velroyen | |
33 | 820bade9 | Helga Velroyen | class TestFileStorageSpaceInfo(unittest.TestCase): |
34 | 820bade9 | Helga Velroyen | |
35 | 820bade9 | Helga Velroyen | def testSpaceInfoPathInvalid(self): |
36 | 820bade9 | Helga Velroyen | """Tests that an error is raised when the given file is not existing.
|
37 | 820bade9 | Helga Velroyen |
|
38 | 820bade9 | Helga Velroyen | """
|
39 | 820bade9 | Helga Velroyen | self.assertRaises(errors.CommandError, filestorage.GetSpaceInfo,
|
40 | 820bade9 | Helga Velroyen | "/path/does/not/exist/")
|
41 | 820bade9 | Helga Velroyen | |
42 | 820bade9 | Helga Velroyen | def testSpaceInfoPathValid(self): |
43 | 820bade9 | Helga Velroyen | """Tests that the 'df' command is run if the file is valid.
|
44 | 820bade9 | Helga Velroyen |
|
45 | 820bade9 | Helga Velroyen | """
|
46 | 820bade9 | Helga Velroyen | info = filestorage.GetSpaceInfo("/")
|
47 | 820bade9 | Helga Velroyen | |
48 | 820bade9 | Helga Velroyen | |
49 | 820bade9 | Helga Velroyen | if __name__ == "__main__": |
50 | 820bade9 | Helga Velroyen | testutils.GanetiTestProgram() |