summaryrefslogtreecommitdiff
path: root/tests/spec/validator_spec.rb
blob: ceed3c202abf0dbbc978f7902b0c1573c2a8479c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
require 'spec_helper'

def run_validate(extra = '')
    run_command 'hscript-validate ' + IFILE_PATH + extra
end

PARSER_SUCCESS = /parser: 0 error\(s\), 0 warning\(s\)/
VALIDATOR_SUCCESS = /validator: 0 failure\(s\)/

RSpec.describe 'HorizonScript validation', :type => :aruba do
    context "Utility argument passing" do
        it "requires an installfile to be specified" do
            run_command 'hscript-validate'
            expect(last_command_started).to have_output(/must specify an installfile/)
        end
        it "supports version output" do
            run_command 'hscript-validate --version'
            expect(last_command_started).to_not have_output(/Allowed options/)
        end
        it "accepts -i flag" do
            run_command 'hscript-validate foo -i'
            expect(last_command_started).to_not have_output(/Allowed options/)
        end
        it "doesn't output ANSI colours when instructed not to" do
            run_command 'hscript-validate foo -n'
            expect(last_command_started).to_not have_output(/\033/)
        end
        it "doesn't output ANSI colours when redirected" do
            run_command 'hscript-validate foo 2>/dev/null'
            expect(last_command_started).to_not have_output(/\033/)
        end
    end
    context "with invalid keys" do
        # No requirement - but was noted in the original draft vision doc as
        # desireable because it allows future expansion while retaining some
        # compatibility.
        it "warns on invalid keys by default" do
            use_fixture '0016-invalid-key.installfile'
            run_validate
            expect(last_command_started).to have_output(/warning: .*chat.* not defined/)
        end
        it "errors on invalid keys in strict mode" do
            use_fixture '0016-invalid-key.installfile'
            run_validate ' --strict'
            expect(last_command_started).to have_output(/error: .*chat.* not defined/)
        end
    end
    context "parsing" do
        # obvious...
        it "successfully reads a basic installfile" do
            use_fixture '0001-basic.installfile'
            run_validate
            expect(last_command_started).to have_output(PARSER_SUCCESS)
            expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
        end
        # HorizonScript Specification, ch 3.
        it "handles comments" do
            use_fixture '0002-basic-commented.installfile'
            run_validate
            expect(last_command_started).to have_output(PARSER_SUCCESS)
            expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
        end
        # HorizonScript Specification, ch 3.
        it "handles blank lines and indentation" do
            use_fixture '0003-basic-whitespace.installfile'
            run_validate
            expect(last_command_started).to have_output(PARSER_SUCCESS)
            expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
        end
        it "requires keys to have values" do
            use_fixture '0015-keys-without-values.installfile'
            run_validate ' --keep-going'
            expect(last_command_started).to have_output(/parser: 2 error\(s\)/)
        end
        # XXX: no requirement.
        it "fails on lines over maximum line length" do
            use_fixture '0017-line-too-long.installfile'
            run_validate
            expect(last_command_started).to have_output(/error: .*length/)
        end
        context "required keys" do
            # Runner.Validate.Required.
            # Runner.Validate.network.
            it "fails without a 'network' key" do
                use_fixture '0006-no-network.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*network.*/)
            end
            # Runner.Validate.Required.
            # Runner.Validate.hostname.
            it "fails without a 'hostname' key" do
                use_fixture '0007-no-hostname.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*hostname.*/)
            end
            # Runner.Validate.Required.
            # Runner.Validate.pkginstall.
            it "fails without a 'pkginstall' key" do
                use_fixture '0008-no-pkginstall.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*pkginstall.*/)
            end
            # Runner.Validate.Required.
            # Runner.Validate.rootpw.
            it "fails without a 'rootpw' key" do
                use_fixture '0009-no-rootpw.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*rootpw.*/)
            end
            # Runner.Validate.Required.
            # Runner.Validate.mount.
            it "fails without a 'mount' key" do
                use_fixture '0010-no-mount.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*mount.*/)
            end
        end
        context "values" do
            context "for 'network' key" do
                # Runner.Validate.network.
                it "fails with an invalid 'network' value" do
                    use_fixture '0011-invalid-network.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*network.*/)
                end
            end
            # Runner.Validate.hostname.
            context "for 'hostname' key" do
                # Runner.Validate.hostname.Chars.
                it "with invalid characters" do
                    use_fixture '0012-invalid-hostname.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*hostname.*/)
                end
                # Runner.Validate.hostname.Begin.
                it "with non-alphanumeric first character" do
                    use_fixture '0246-hostname-nonalnum.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*hostname.*/)
                end
                # Runner.Validate.hostname.Length
                it "with >320 characters" do
                    use_fixture '0025-jumbo-hostname.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*hostname.*/)
                end
                # Runner.Validate.hostname.PartLength
                it "with >64 characters in a single part" do
                    use_fixture '0026-jumbo-part-hostname.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*hostname.*/)
                end
                # Runner.Validate.hostname.
                it "with dot at end of domain" do
                    use_fixture '0032-hostname-ends-with-dot.installfile'
                    run_validate
                    expect(last_command_started).to_not have_output(/error: .*hostname.*/)
                end
            end
            # Runner.Validate.rootpw.
            # Runner.Validate.rootpw.Crypt.
            it "fails with an invalid 'rootpw' value" do
                use_fixture '0013-invalid-rootpw.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*rootpw.*/)
            end
            context "for 'language' key" do
                # Runner.Validate.language
                # Runner.Validate.language.Format
                it "supports a simple language" do
                    use_fixture '0115-language-simple.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "supports a language_territory value" do
                    use_fixture '0116-language-country.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "supports the UTF-8 codeset" do
                    use_fixture '0117-language-codeset.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "supports the special case C.UTF-8" do
                    use_fixture '0118-language-c-exception.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "requires a valid language" do
                    use_fixture '0119-language-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*language.*invalid/)
                end
                it "requires the UTF-8 codeset" do
                    use_fixture '0120-language-iso.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*language.*codeset/)
                end
                it "requires a valid two-char language" do
                    use_fixture '0199-language-invalid2.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*language.*invalid/)
                end
            end
            context "for 'arch' key" do
                    it "succeeds with valid architecture" do
                    use_fixture '0223-arch-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "warns on unrecognised architecture" do
                    use_fixture '0224-arch-unknown.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/warning: .*arch.*unknown CPU/)
                end
                it "fails on malformed architecture name" do
                    use_fixture '0225-arch-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*arch.*expected/)
                end
            end
            context "for 'netconfigtype' key" do
                it "succeeds with netifrc specified" do
                    use_fixture '0226-netconfigtype-netifrc.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with /etc/network/interfaces specified" do
                    use_fixture '0227-netconfigtype-eni.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an invalid value" do
                    use_fixture '0228-netconfigtype-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netconfigtype.*valid/)
                end
            end
            context "for 'nameserver' key" do
                it "succeeds with IPv4 and IPv6 addresses" do
                    use_fixture '0183-nameserver-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an invalid value" do
                    use_fixture '0184-nameserver-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*nameserver.*expected/)
                end
                it "fails with brackets around IPv6 addresses" do
                    use_fixture '0185-nameserver-brackets.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/nameserver.*brackets/)
                end
                it "warns with more than MAXNS nameservers" do
                    use_fixture '0201-nameserver-max.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/warning: .*nameserver.*more/)
                end
                it "fails with an invalid IPv4 address" do
                    use_fixture '0202-nameserver-bad4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*nameserver.*valid IPv4/)
                end
                it "fails with an invalid IPv6 address" do
                    use_fixture '0203-nameserver-bad6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*nameserver.*valid IPv6/)
                end
            end
            context "for 'pppoe' key" do
                it "succeeds with only an interface" do
                    use_fixture '0241-pppoe-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with autnentication credentials" do
                    use_fixture '0242-pppoe-auth.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with all valid keys" do
                    use_fixture '0243-pppoe-allkeys.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an invalid key" do
                    use_fixture '0244-pppoe-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*pppoe.*invalid/)
                end
                it "succeeds with a value-less key" do
                    use_fixture '0245-pppoe-valueless.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
            end
            context "for 'firmware' key" do
                it "always supports 'false' value" do
                    use_fixture '0112-firmware-false.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "requires 'false' if built without support" do
                    use_fixture '0111-firmware-true.installfile'
                    run_validate
                    skip "This build supports firmware" if last_command_started.stdout =~ /supports non-free/
                    expect(last_command_started).to have_output(/error: .*firmware/)
                end
                it "supports 'true' if built with support" do
                    use_fixture '0111-firmware-true.installfile'
                    run_validate
                    skip "This build does not support firmware" if last_command_started.stdout !~ /supports non-free/
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "requires a boolean value" do
                    use_fixture '0113-firmware-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*firmware.*value/)
                end
            end
            context "for 'timezone' key" do
                # Runner.Validate.timezone.
                it "fails with an invalid value" do
                    use_fixture '0132-timezone-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*timezone.*invalid/)
                end
                # Runner.Validate.timezone.
                it "fails with a maliciously invalid value" do
                    use_fixture '0133-timezone-malicious.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*timezone.*invalid/)
                end
                # Runner.Validate.timezone.zoneinfo.
                it "succeeds with simple value" do
                    use_fixture '0131-timezone-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.timezone.zoneinfo.
                it "succeeds with Locality/Zone value" do
                    use_fixture '0134-timezone-subtz.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
            end
            context "for 'mount' key" do
                # Runner.Validate.mount.
                it "fails with an invalid value" do
                    use_fixture '0014-invalid-mount.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*/)
                end
                # Runner.Validate.mount.Validity.
                it "fails with too many values in 'mount' tuple" do
                    use_fixture '0029-mount-too-many.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*elements/)
                end
                # Runner.Validate.mount.Validity.
                it "fails with too few values in 'mount' tuple" do
                    use_fixture '0030-mount-too-few.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*elements/)
                end
                # Runner.Validate.mount.Block.
                it "fails with a 'mount' value that has no block device" do
                    use_fixture '0027-mount-invalid-dev.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*device/)
                end
                # Runner.Validate.mount.Point.
                it "fails with a 'mount' value that has an invalid mountpoint" do
                    use_fixture '0028-mount-non-absolute.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*path/)
                end
                # Runner.Validate.mount.Unique.
                it "fails with two root 'mount' keys" do
                    use_fixture '0021-duplicate-root-mount.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*duplicate/)
                end
                # Runner.Validate.mount.Root.
                it "fails without a root 'mount' key" do
                    use_fixture '0031-mount-nonroot.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*mount.*root/)
                end
            end
            context "for 'netaddress' key" do
                # Runner.Validate.network. / Runner.Validate.netaddress.
                it "requires 'netaddress' when 'network' is true" do
                    use_fixture '0033-network-without-netaddress.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*/)
                end
                it "allows 'netaddress' when 'network' is false" do
                    use_fixture '0034-nonetwork-with-netaddress.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with simple 'netaddress' (DHCP on eth0)" do
                    use_fixture '0035-network-with-netaddress.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.netaddress.Validity.
                it "requires 'netaddress' to have at least two elements" do
                    use_fixture '0036-netaddress-too-few.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*require/)
                end
                it "fails with invalid interface name" do
                    use_fixture '0130-netaddress-invalid-iface.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*interface/)
                end
                # Runner.Validate.netaddress.Validity.Type.
                it "fails on invalid address type" do
                    use_fixture '0037-netaddress-invalid-type.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*type/)
                end
                # Runner.Validate.netaddress.Validity.DHCP.
                it "fails on extraneous elements in DHCP mode" do
                    use_fixture '0038-netaddress-invalid-dhcp.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*dhcp/)
                end
                # Runner.Validate.netaddress.Validity.DHCP.
                it "fails on extraneous elements in SLAAC mode" do
                    use_fixture '0058-netaddress-invalid-slaac.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*slaac/)
                end
                # Runner.Validate.netaddress.Validity.Static.
                it "fails on extraneous elements in static mode" do
                    use_fixture '0039-netaddress-static-too-many.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*too many/)
                end
                # Runner.Validate.netaddress.Validity.Static.
                it "fails on too few elements in static mode" do
                    use_fixture '0040-netaddress-static-too-few.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*require/)
                end
                # Runner.Validate.netaddress.Validity.Address.
                it "succeeds with valid IPv4 address specification" do
                    use_fixture '0041-netaddress-valid-static4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.netaddress.Validity.Address.
                it "succeeds with valid IPv6 address specification" do
                    use_fixture '0042-netaddress-valid-static6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.netaddress.Validity.Address.
                it "fails with invalid IPv4 address specification" do
                    use_fixture '0043-netaddress-invalid-static4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*address/)
                end
                # Runner.Validate.netaddress.Validity.Address.
                it "fails with invalid IPv6 address specification" do
                    use_fixture '0044-netaddress-invalid-static6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*address/)
                end
                # Runner.Validate.netaddress.Validity.Address.
                it "fails with invalid address" do
                    use_fixture '0059-netaddress-invalid-address.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*address/)
                end
                # Runner.Validate.netaddress.Validity.Mask.
                it "fails with invalid IPv4 prefix length" do
                    use_fixture '0045-netaddress-invalid-prefix4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*/)
                end
                # Runner.Validate.netaddress.Validity.Mask.
                it "fails with invalid IPv6 prefix length" do
                    use_fixture '0046-netaddress-invalid-prefix6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*prefix/)
                end
                # Runner.Validate.netaddress.Validity.Mask.
                it "fails with non-numeric IPv4 prefix length" do
                    use_fixture '0060-netaddress-invalid-prefix4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*prefix/)
                end
                # Runner.Validate.netaddress.Validity.Mask.
                it "fails with non-numeric IPv6 prefix length" do
                    use_fixture '0061-netaddress-invalid-prefix6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*prefix/)
                end
                # Runner.Validate.netaddress.Validity.Mask.
                it "fails with invalid IPv4 network mask" do
                    use_fixture '0047-netaddress-invalid-mask.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*/)
                end
                # Runner.Validate.netaddress.Validity.Gateway.
                it "succeeds with valid IPv4 gateway" do
                    use_fixture '0048-netaddress-gateway4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.netaddress.Validity.Gateway.
                it "succeeds with valid IPv6 gateway" do
                    use_fixture '0049-netaddress-gateway6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.netaddress.Validity.Gateway.
                it "fails with invalid IPv4 gateway" do
                    use_fixture '0050-netaddress-bad-gateway4.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*gateway/)
                end
                # Runner.Validate.netaddress.Validity.Gateway.
                it "fails with invalid IPv6 gateway" do
                    use_fixture '0051-netaddress-bad-gateway6.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*gateway/)
                end
                # Runner.Validate.netaddress.Validity.Gateway.
                it "fails with mismatched IPv4/v6 gateway" do
                    use_fixture '0052-netaddress-bad-gateway46.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*gateway/)
                end
                # Runner.Validate.netaddress.Validity.Gateway.
                it "fails with mismatched IPv6/v4 gateway" do
                    use_fixture '0053-netaddress-bad-gateway64.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*gateway/)
                end
                # Runner.Validate.netaddress.Validity.Count.
                it "fails with too many addresses" do
                    use_fixture '0054-huge-netaddress.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netaddress.*addresses/)
                end
            end
            context "for 'netssid' key" do
                it "succeeds with simple SSID, no security" do
                    use_fixture '0062-netssid-simple-none.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with simple SSID, WEP security" do
                    use_fixture '0063-netssid-simple-wep.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with simple SSID, WPA security" do
                    use_fixture '0064-netssid-simple-wpa.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with complex SSID, no security" do
                    use_fixture '0065-netssid-spaces-none.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with complex SSID, WEP security" do
                    use_fixture '0066-netssid-spaces-wep.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with complex SSID, WPA security" do
                    use_fixture '0067-netssid-spaces-wpa.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with invalid interface name" do
                    use_fixture '0068-netssid-invalid-iface.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*interface/)
                end
                it "fails with raw / unquoted SSID" do
                    use_fixture '0069-netssid-unquoted.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*quote/)
                end
                it "fails with SSID without terminating quote" do
                    use_fixture '0070-netssid-syntax-error.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*unterminated/)
                end
                it "fails with missing passphrase" do
                    use_fixture '0071-netssid-missing-pw.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*expected/)
                end
                it "fails with missing SSID" do
                    use_fixture '0072-netssid-missing-ssid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*expected/)
                end
                it "fails with invalid security type" do
                    use_fixture '0073-netssid-invalid-type.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*security/)
                end
                it "fails with missing security type" do
                    use_fixture '0220-netssid-missing-type.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*netssid.*security type expected/)
                end
            end
            context "for 'repository' key" do
                it "succeeds with basic repositories" do
                    use_fixture '0055-repository-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with invalid repository URL" do
                    use_fixture '0056-repository-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*repository/)
                end
                it "fails with too many repositories specified" do
                    use_fixture '0218-repository-max.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*repository.*too many/)
                end
            end
            context "for 'signingkey' key" do
                it "succeeds with secure key URL" do
                    use_fixture '0186-signingkey-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with local key URL" do
                    use_fixture '0187-signingkey-local.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with insecure key URL" do
                    use_fixture '0188-signingkey-insec.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*signingkey/)
                end
                it "fails with too many signing keys specified" do
                    use_fixture '0219-signingkey-max.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*signingkey.*too many/)
                end
            end
            context "for 'version' key" do
                it "succeeds with a basic version string" do
                    use_fixture '0247-version-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an invalid version string" do
                    use_fixture '0248-version-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*version.*/)
                end
            end
            context "for 'pkginstall' key" do
                it "warns when a package is listed twice in the same line" do
                    use_fixture '0216-pkginstall-dup-single.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/warning: .*pkginstall.*already/)
                end
                it "warns when a package is listed twice in the same script" do
                    use_fixture '0217-pkginstall-dup-multi.installfile'
                    run_validate ' -s'
                    expect(last_command_started).to have_output(/warning: .*pkginstall.*already/)
                end
            end
            context "for 'svcenable' key" do
                it "succeeds with a basic service" do
                    use_fixture '0229-svcenable-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "warns when a service is specified twice" do
                    use_fixture '0230-svcenable-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/warning: .*svcenable.*already/)
                end
                it "fails when an invalid service name is specified" do
                    use_fixture '0231-svcenable-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*svcenable.*invalid/)
                end
                it "succeeds with a runlevel specified" do
                    use_fixture '0239-svcenable-runlevel.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
            end
            context "for 'diskid' key" do
                it "succeeds with basic disk identification" do
                    use_fixture '0076-diskid-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "requires an identification string" do
                    use_fixture '0077-diskid-missing-id.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*diskid.*expected/)
                end
                it "succeeds with present disk" do
                    use_fixture '0078-diskid-diskid-loop0.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with non-present disk" do
                    use_fixture '0079-diskid-enoent.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(/No such file or directory/)
                end
                it "fails with non-disk file" do
                    use_fixture '0080-diskid-tmp.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(/error: .*diskid.*block/)
                end
                it "fails with a duplicate identification device" do
                    use_fixture '0081-diskid-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*diskid.*already/)
                end
            end
            context "for 'disklabel' key" do
                it "requires a label type" do
                    use_fixture '0129-disklabel-without-label.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*disklabel.*expected/)
                end
                it "succeeds with a APM disk label" do
                    use_fixture '0122-disklabel-apm.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with a MBR disk label" do
                    use_fixture '0123-disklabel-mbr.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "succeeds with a GPT disk label" do
                    use_fixture '0124-disklabel-gpt.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with a duplicate disk" do
                    use_fixture '0125-disklabel-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*disklabel.*already/)
                end
                it "succeeds with present disk" do
                    use_fixture '0126-disklabel-loop0.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with non-present disk" do
                    use_fixture '0127-disklabel-enoent.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(/error: .*disklabel.*block/)
                end
                it "requires a valid label type" do
                    use_fixture '0128-disklabel-invalid-type.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*disklabel.*type/)
                end
            end
            context "for 'partition' key" do
                it "succeeds with a typical value" do
                    use_fixture '0135-partition-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                context "size value" do
                    it "supports bytes" do
                        use_fixture '0136-partition-size-bytes.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "supports kilobytes (K)" do
                        use_fixture '0137-partition-size-kbytes.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "supports megabytes (M)" do
                        use_fixture '0138-partition-size-mbytes.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "supports gigabytes (G)" do
                        use_fixture '0139-partition-size-gbytes.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "supports terabytes (T)" do
                        use_fixture '0140-partition-size-tbytes.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "does not support exabytes (E)" do
                        use_fixture '0141-partition-size-ebytes.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*suffix/)
                    end
                    it "supports percentages" do
                        use_fixture '0142-partition-size-percent.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "does not support percentages over 100" do
                        use_fixture '0143-partition-size-percent-overflow.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*too large/)
                    end
                    it "supports the literal value 'fill'" do
                        use_fixture '0144-partition-size-fill.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "does not support non-numeric values" do
                        use_fixture '0145-partition-size-nonnumeric.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*number/)
                    end
                    it "does not support incorrect suffixes" do
                        use_fixture '0146-partition-size-bad-suffix.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*suffix/)
                    end
                    it "correctly handles byte overflow" do
                        use_fixture '0147-partition-size-overflow.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*too large/)
                    end
                    it "correctly handles kilobyte overflow (K)" do
                        use_fixture '0148-partition-size-overflow-k.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*too large/)
                    end
                    it "correctly handles megabyte overflow (M)" do
                        use_fixture '0149-partition-size-overflow-m.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*too large/)
                    end
                    it "correctly handles gigabyte overflow (G)" do
                        use_fixture '0150-partition-size-overflow-g.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*too large/)
                    end
                    it "correctly handles terabyte overflow (T)" do
                        use_fixture '0151-partition-size-overflow-t.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*too large/)
                    end
                    it "supports mixed-case 'fill'" do
                        use_fixture '0162-partition-size-case.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                end
                context "type code" do
                    it "handles 'boot'" do
                        use_fixture '0152-partition-type-boot.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "handles 'esp'" do
                        use_fixture '0153-partition-type-esp.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "handles no value" do
                        use_fixture '0154-partition-type-none.installfile'
                        run_validate
                        expect(last_command_started).to have_output(PARSER_SUCCESS)
                        expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    end
                    it "errors on invalid type code" do
                        use_fixture '0155-partition-type-invalid.installfile'
                        run_validate
                        expect(last_command_started).to have_output(/error: .*partition.*invalid/)
                    end
                end
                it "errors on non-numeric partition number" do
                    use_fixture '0156-partition-num-nonnumeric.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*partition.*number/)
                end
                it "requires a block device" do
                    use_fixture '0157-partition-nonblock.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(/error: .*partition.*block/)
                end
                it "requires an absolute device path" do
                    use_fixture '0158-partition-nondev.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*partition.*device/)
                end
                it "requires partition numbers to be unique per block device" do
                    use_fixture '0159-partition-num-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*partition.*already exists/)
                end
                it "requires a partition number" do
                    use_fixture '0160-partition-missing-num.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*partition.*expected/)
                end
                it "requires a size" do
                    use_fixture '0161-partition-missing-size.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*partition.*size/)
                end
            end
            context "for 'lvm_pv' key" do
                it "succeeds with normal value" do
                    use_fixture '0163-lvmpv-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with a non-absolute block device path" do
                    use_fixture '0164-lvmpv-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_pv.*path/)
                end
                it "fails with duplicate physical volumes" do
                    use_fixture '0165-lvmpv-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_pv.*exists/)
                end
            end
            context "for 'lvm_vg' key" do
                it "succeeds with a normal value" do
                    use_fixture '0166-lvmvg-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an invalid PV path" do
                    use_fixture '0167-lvmvg-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_vg.*path/)
                end
                it "fails with a duplicate volume group name" do
                    use_fixture '0168-lvmvg-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_vg.*exists/)
                end
                it "fails with a dash as the first character of the VG name" do
                    use_fixture '0169-lvmvg-dash.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_vg.*name/)
                end
                it "requires a volume group name" do
                    use_fixture '0170-lvmvg-without-vg.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_vg.*expected/)
                end
                it "fails with a dot as the VG name" do
                    use_fixture '0207-lvmvg-dot.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_vg.*name/)
                end
                it "succeeds with a dot in the VG name" do
                    use_fixture '0208-lvmvg-valid-dot.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "warns when a PV isn't created" do
                    use_fixture '0214-lvmvg-without-pv.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/warning: .*lvm_vg.*physical volume/)
                end
            end
            context "for 'lvm_lv' key" do
                it "succeeds with a simple value" do
                    use_fixture '0171-lvmlv-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "requires a valid volume group name" do
                    use_fixture '0172-lvmlv-badvg.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*name/)
                end
                it "requires a valid logical volume name" do
                    use_fixture '0173-lvmlv-badlv.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*name/)
                end
                it "requires a valid size" do
                    use_fixture '0174-lvmlv-bad-size.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*size/)
                end
                it "requires a size to be specified" do
                    use_fixture '0175-lvmlv-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*expected/)
                end
                it "requires a unique VG/LV name pair" do
                    use_fixture '0176-lvmlv-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*already/)
                end
                it "requires the volume group to be present" do
                    use_fixture '0177-lvmlv-no-vg.installfile'
                    run_validate ' -i'
                    skip "This build does not support this test" if last_command_started.stdout =~ /runtime environment only/
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*volume group/)
                end
                it "fails if the logical volume name starts with a dash" do
                    use_fixture '0209-lvmlv-dash.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*name/)
                end
                it "fails if the logical volume name is reserved" do
                    use_fixture '0210-lvmlv-snapshot.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*name/)
                    use_fixture '0211-lvmlv-pvmove.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*lvm_lv.*name/)
                end
            end
            context "for 'encrypt' key" do
                it "succeeds with a simple value" do
                    use_fixture '0189-encrypt-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with a duplicate block device" do
                    use_fixture '0190-encrypt-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*encrypt.*already/)
                end
                it "fails with an invalid block device" do
                    use_fixture '0191-encrypt-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*encrypt.*expected/)
                end
                it "succeeds with a passphrase" do
                    use_fixture '0192-encrypt-pw.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
            end
            context "for 'fs' key" do
                it "succeeds with a simple value" do
                    use_fixture '0179-fs-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "requires a filesystem type" do
                    use_fixture '0180-fs-without-fs.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*fs.*expected/)
                end
                it "requires a valid absolute block device path" do
                    use_fixture '0181-fs-invalid-dev.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*fs.*device/)
                end
                it "requires a valid filesystem type" do
                    use_fixture '0182-fs-invalid-type.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*fs.*type/)
                end
                it "fails with a duplicate block device" do
                    use_fixture '0206-fs-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*fs.*already/)
                end
            end
            context "for 'bootloader' key" do
                it "succeeds with valid values" do
                    use_fixture '0250-bootloader-x86efi.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                    use_fixture '0251-bootloader-x86bios.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with invalid values" do
                    use_fixture '0240-bootloader-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*bootloader.*/)
                    use_fixture '0249-bootloader-ppc.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*bootloader.*/)
                end
                it "fails with unprepared architectures" do
                    use_fixture '0252-bootloader-alpha.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*bootloader.*/)
                end
            end
            context "for 'keymap' key" do
                it "succeeds with a simple value" do
                    use_fixture '0178-keymap-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an invalid value" do
                    use_fixture '0198-keymap-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*keymap.*invalid/)
                end
            end
        end
        context "unique keys" do
            # Runner.Validate.network.
            it "fails with a duplicate 'network' key" do
                use_fixture '0018-duplicate-network.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*duplicate.*network/)
            end
            # Runner.Validate.hostname.
            it "fails with a duplicate 'hostname' key" do
                use_fixture '0019-duplicate-hostname.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*duplicate.*hostname/)
            end
            # Runner.Validate.rootpw.
            it "fails with a duplicate 'rootpw' key" do
                use_fixture '0020-duplicate-rootpw.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*duplicate.*rootpw/)
            end
            # Runner.Validate.firmware.
            it "fails with a duplicate 'firmware' key" do
                use_fixture '0114-firmware-duplicate.installfile'
                run_validate
                skip "This build does not support firmware" if last_command_started.stdout !~ /supports non-free/
                expect(last_command_started).to have_output(/error: .*duplicate.*firmware/)
            end
            it "fails with a duplicate 'language' key" do
                use_fixture '0121-language-duplicate.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*duplicate.*language/)
            end
            it "fails with a duplicate 'keymap' key" do
                use_fixture '0204-keymap-duplicate.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*duplicate.*keymap/)
            end
            it "fails with a duplicate 'timezone' key" do
                use_fixture '0205-timezone-duplicate.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*duplicate.*timezone/)
            end
        end
        context "user account keys:" do
            context "'username'" do
                # Runner.Validate.username.
                it "succeeds with multiple usernames" do
                    use_fixture '0082-username-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.username.Unique.
                it "fails with duplicate usernames" do
                    use_fixture '0083-username-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*duplicate.*username/)
                end
                # Runner.Validate.username.System.
                it "fails with a system username" do
                    use_fixture '0084-username-system.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*username.*system/)
                end
                # Runner.Validate.username.
                it "fails with more than 255 usernames" do
                    use_fixture '0085-all-the-username.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*username.*too many/)
                end
                it "fails with an invalid username" do
                    use_fixture '0086-username-invalid.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*username.*invalid/)
                end
            end
            context "'useralias'" do
                # Runner.Validate.useralias.
                it "succeeds with usernames with aliases" do
                    use_fixture '0087-useralias-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.useralias.Validity.
                it "requires an alias to be provided" do
                    use_fixture '0088-useralias-without-alias.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*useralias.*required/)
                end
                # Runner.Validate.useralias.Name.
                it "fails with a username that wasn't given" do
                    use_fixture '0089-useralias-unknown-name.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*useralias.*name/)
                end
                # Runner.Validate.useralias.Unique.
                it "fails with a duplicated alias" do
                    use_fixture '0090-useralias-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*duplicate.*useralias/)
                end
            end
            context "'userpw'" do
                # Runner.Validate.userpw.
                it "succeeds with username/passphrase combinations" do
                    use_fixture '0091-userpw-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.userpw.Validity.
                it "requires a passphrase to be provided" do
                    use_fixture '0092-userpw-without-pw.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*userpw.*required/)
                end
                # Runner.Validate.userpw.Name.
                it "fails with a username that wasn't given" do
                    use_fixture '0093-userpw-unknown-name.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*userpw.*name/)
                end
                # Runner.Validate.userpw.Unique.
                it "fails with more than one passphrase for an account" do
                    use_fixture '0094-userpw-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*duplicate.*userpw/)
                end
                # Runner.Validate.userpw.Crypt.
                it "fails with a plain-text password" do
                    use_fixture '0095-userpw-plaintext.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*userpw.*crypt/)
                end
                it "fails with an invalid encryption algorithm" do
                    use_fixture '0096-userpw-md5.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*userpw.*crypt/)
                end
                # Runner.Validate.userpw.None.
                it "warns when an account doesn't have a passphrase" do
                    use_fixture '0097-userpw-missing.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/warning: .*passphrase/)
                end
            end
            context "'usericon'" do
                # Runner.Validate.usericon.
                it "succeeds with a valid icon/account pair" do
                    use_fixture '0098-usericon-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.usericon.Validity.
                it "requires a path to be provided" do
                    use_fixture '0099-usericon-without-icon.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usericon.*required/)
                end
                # Runner.Validate.usericon.Name.
                it "fails with a username that wasn't given" do
                    use_fixture '0100-usericon-unknown-name.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usericon.*name/)
                end
                # Runner.Validate.usericon.Unique.
                it "fails with multiple icons associated with a single account" do
                    use_fixture '0101-usericon-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*duplicate.*usericon/)
                end
                # Runner.Validate.usericon.ValidPath.
                it "succeeds with all supported protocols" do
                    use_fixture '0102-usericon-protocols.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                it "fails with an unsupported protocol" do
                    use_fixture '0103-usericon-gopher.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usericon.*URL/)
                end
            end
            context "'usergroups'" do
                # Runner.Validate.usergroups.
                it "succeeds with a valid account/group set" do
                    use_fixture '0104-usergroups-basic.installfile'
                    run_validate
                    expect(last_command_started).to have_output(PARSER_SUCCESS)
                    expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
                end
                # Runner.Validate.usergroups.Validity.
                it "requires at least one group to be provided" do
                    use_fixture '0105-usergroups-without-groups.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*required/)
                end
                it "doesn't allow a group name longer than maximum" do
                    use_fixture '0215-usergroups-length.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*exceeds maximum length/)
                end
                it "correctly errors when only a , is given" do
                    use_fixture '0106-usergroups-comma.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*invalid/)
                end
                # Runner.Validate.usergroups.Name.
                it "fails with a username that wasn't given" do
                    use_fixture '0107-usergroups-unknown-name.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*name/)
                end
                # Runner.Validate.usergroups.Count.
                it "fails with more than 16 groups for a single name" do
                    use_fixture '0108-jumbo-usergroups.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*16/)
                end
                # Runner.Validate.usergroups.Group.
                it "fails with an unknown group name" do
                    use_fixture '0109-usergroups-unknown.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*group/)
                end
                # Runner.Validate.usergroups.Unique.
                it "fails with the same group specified twice" do
                    use_fixture '0110-usergroups-duplicate.installfile'
                    run_validate
                    expect(last_command_started).to have_output(/error: .*usergroups.*duplicate/)
                end
            end
        end
        context "package specifications" do
            # no requirements for these, but I think obvious.
            it "works with all types of package atoms" do
                use_fixture '0022-all-kinds-of-atoms.installfile'
                run_validate
                expect(last_command_started).to have_output(PARSER_SUCCESS)
                expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
            end
            it "does not accept invalid package atoms" do
                use_fixture '0023-pkginstall-invalid-modifier.installfile'
                run_validate
                expect(last_command_started).to have_output(/error: .*expected package.*/)
            end
        end
    end
end