~ubuntu-branches/ubuntu/vivid/augeas/vivid-proposed

« back to all changes in this revision

Viewing changes to lenses/tests/test_lvm.aug

  • Committer: Package Import Robot
  • Author(s): Raphaël Pinson
  • Date: 2014-12-01 10:49:19 UTC
  • mfrom: (1.6.1) (24.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20141201104919-lalkacyk0i5fndg5
Tags: 1.3.0-0ubuntu1
* New upstream version
* Include d/p/0003_Link_pthread.patch again

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(*
 
2
Module: Test_LVM
 
3
  Provides unit tests and examples for the <LVM> lens.
 
4
*)
 
5
 
 
6
module Test_LVM =
 
7
 
 
8
(* Variable: conf
 
9
   A full configuration file *)
 
10
let conf = "# Generated by LVM2: date
 
11
 
 
12
contents = \"Text Format Volume Group\"
 
13
version = 1
 
14
 
 
15
description = \"Created *after* executing 'eek'\"
 
16
 
 
17
creation_host = \"eek\"         # Linux eek
 
18
creation_time = 6666666666      # eeeek
 
19
 
 
20
VG1 {
 
21
        id = \"uuid-uuid-uuid-uuid\"
 
22
        seqno = 2
 
23
        status = [\"RESIZEABLE\", \"READ\", \"WRITE\"]
 
24
        extent_size = 8192              # 4 Megabytes
 
25
        max_lv = 0
 
26
        max_pv = 0
 
27
        process_priority = -18
 
28
 
 
29
        physical_volumes {
 
30
                pv0 {
 
31
                        id = \"uuid-uuid-uuid-uuid\"
 
32
                        device = \"/dev/sda6\"  # Hint only
 
33
 
 
34
                        status = [\"ALLOCATABLE\"]
 
35
                        pe_start = 123
 
36
                        pe_count = 123456       # many Gigabytes
 
37
                }
 
38
        }
 
39
 
 
40
        logical_volumes {
 
41
                LogicalEek {
 
42
                        id = \"uuid-uuid-uuid-uuid\"
 
43
                        status = [\"READ\", \"WRITE\", \"VISIBLE\"]
 
44
                        segment_count = 1
 
45
 
 
46
                        segment1 {
 
47
                                start_extent = 0
 
48
                                extent_count = 123456   # beaucoup Gigabytes
 
49
 
 
50
                                type = \"striped\"
 
51
                                stripe_count = 1        # linear
 
52
 
 
53
                                stripes = [
 
54
                                        \"pv0\", 0
 
55
                                ]
 
56
                        }
 
57
                }
 
58
        }
 
59
}
 
60
"
 
61
 
 
62
test LVM.int get "5" = { "int" = "5" }
 
63
test LVM.str get "\"abc\"" = { "str" = "abc"}
 
64
test LVM.lns get "\n" = {}
 
65
test LVM.lns get "#foo\n" = { "#comment" = "foo"}
 
66
 
 
67
test LVM.lns get "# Generated by LVM2: date
 
68
 
 
69
contents = \"Text Format Volume Group\"
 
70
version = 1
 
71
 
 
72
description = \"Created *after* executing 'eek'\"
 
73
 
 
74
creation_host = \"eek\"         # Linux eek
 
75
creation_time = 6666666666      # eeeek\n" =
 
76
        { "#comment" = "Generated by LVM2: date" }
 
77
        {}
 
78
        { "contents"
 
79
                { "str" = "Text Format Volume Group" }
 
80
        }
 
81
        { "version"
 
82
                { "int" = "1" }
 
83
        }
 
84
        {}
 
85
        { "description"
 
86
                { "str" = "Created *after* executing 'eek'" }
 
87
        }
 
88
        {}
 
89
        { "creation_host"
 
90
                { "str" = "eek" }
 
91
                { "#comment" = "Linux eek" }
 
92
        }
 
93
        { "creation_time"
 
94
                { "int" = "6666666666" }
 
95
                { "#comment" = "eeeek" }
 
96
        }
 
97
 
 
98
(* Test: LVM.lns
 
99
   Test the full <conf> *)
 
100
test LVM.lns get conf =
 
101
        { "#comment" = "Generated by LVM2: date" }
 
102
        {}
 
103
        { "contents"
 
104
                { "str" = "Text Format Volume Group" }
 
105
        }
 
106
        { "version"
 
107
                { "int" = "1" }
 
108
        }
 
109
        {}
 
110
        { "description"
 
111
                { "str" = "Created *after* executing 'eek'" }
 
112
        }
 
113
        {}
 
114
        { "creation_host"
 
115
                { "str" = "eek" }
 
116
                { "#comment" = "Linux eek" }
 
117
        }
 
118
        { "creation_time"
 
119
                { "int" = "6666666666" }
 
120
                { "#comment" = "eeeek" }
 
121
        }
 
122
        {}
 
123
        { "VG1"
 
124
                { "dict"
 
125
                        { "id"
 
126
                                { "str" = "uuid-uuid-uuid-uuid" }
 
127
                        }
 
128
                        { "seqno"
 
129
                                { "int" = "2" }
 
130
                        }
 
131
                        { "status"
 
132
                                { "list"
 
133
                                        { "1"
 
134
                                                { "str" = "RESIZEABLE" }
 
135
                                        }
 
136
                                        { "2"
 
137
                                                { "str" = "READ" }
 
138
                                        }
 
139
                                        { "3"
 
140
                                                { "str" = "WRITE" }
 
141
                                        }
 
142
                                }
 
143
                        }
 
144
                        { "extent_size"
 
145
                                { "int" = "8192" }
 
146
                                { "#comment" = "4 Megabytes" }
 
147
                        }
 
148
                        { "max_lv"
 
149
                                { "int" = "0" }
 
150
                        }
 
151
                        { "max_pv"
 
152
                                { "int" = "0" }
 
153
                        }
 
154
                        { "process_priority"
 
155
                                { "int" = "-18" }
 
156
                        }
 
157
                        {}
 
158
                        { "physical_volumes"
 
159
                                { "dict"
 
160
                                        { "pv0"
 
161
                                                { "dict"
 
162
                                                        { "id"
 
163
                                                                { "str" = "uuid-uuid-uuid-uuid" }
 
164
                                                        }
 
165
                                                        { "device"
 
166
                                                                { "str" = "/dev/sda6" }
 
167
                                                                { "#comment" = "Hint only" }
 
168
                                                        }
 
169
                                                        {}
 
170
                                                        { "status"
 
171
                                                                { "list"
 
172
                                                                        { "1"
 
173
                                                                                { "str" = "ALLOCATABLE" }
 
174
                                                                        }
 
175
                                                                }
 
176
                                                        }
 
177
                                                        { "pe_start"
 
178
                                                                { "int" = "123" }
 
179
                                                        }
 
180
                                                        { "pe_count"
 
181
                                                                { "int" = "123456" }
 
182
                                                                { "#comment" = "many Gigabytes" }
 
183
                                                        }
 
184
                                                }
 
185
                                        }
 
186
                                }
 
187
                        }
 
188
                        {}
 
189
                        { "logical_volumes"
 
190
                                { "dict"
 
191
                                        { "LogicalEek"
 
192
                                                { "dict"
 
193
                                                        { "id"
 
194
                                                                { "str" = "uuid-uuid-uuid-uuid" }
 
195
                                                        }
 
196
                                                        { "status"
 
197
                                                                { "list"
 
198
                                                                        { "1"
 
199
                                                                                { "str" = "READ" }
 
200
                                                                        }
 
201
                                                                        { "2"
 
202
                                                                                { "str" = "WRITE" }
 
203
                                                                        }
 
204
                                                                        { "3"
 
205
                                                                                { "str" = "VISIBLE" }
 
206
                                                                        }
 
207
                                                                }
 
208
                                                        }
 
209
                                                        { "segment_count"
 
210
                                                                { "int" = "1" }
 
211
                                                        }
 
212
                                                        {}
 
213
                                                        { "segment1"
 
214
                                                                { "dict"
 
215
                                                                        { "start_extent"
 
216
                                                                                { "int" = "0" }
 
217
                                                                        }
 
218
                                                                        { "extent_count"
 
219
                                                                                { "int" = "123456" }
 
220
                                                                                { "#comment" = "beaucoup Gigabytes" }
 
221
                                                                        }
 
222
                                                                        {}
 
223
                                                                        { "type"
 
224
                                                                                { "str" = "striped" }
 
225
                                                                        }
 
226
                                                                        { "stripe_count"
 
227
                                                                                { "int" = "1" }
 
228
                                                                                { "#comment" = "linear" }
 
229
                                                                        }
 
230
                                                                        {}
 
231
                                                                        { "stripes"
 
232
                                                                                { "list"
 
233
                                                                                        { "1"
 
234
                                                                                                { "str" = "pv0" }
 
235
                                                                                        }
 
236
                                                                                        { "2"
 
237
                                                                                                { "int" = "0" }
 
238
                                                                                        }
 
239
                                                                                }
 
240
                                                                        }
 
241
                                                                }
 
242
                                                        }
 
243
                                                }
 
244
                                        }
 
245
                                }
 
246
                        }
 
247
                }
 
248
        }
 
249
 
 
250
(* Parse description from RHEL 6 *)
 
251
let descr="\"Created *before* executing '/sbin/vgs --noheadings -o name --config 'log{command_names=0 prefix=\\\"  \\\"}''\""
 
252
test LVM.str get descr =
 
253
  { "str" = "Created *before* executing '/sbin/vgs --noheadings -o name --config 'log{command_names=0 prefix=\\\"  \\\"}''" }