summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 13:05:47 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 13:05:47 -0500
commit0d626d668ba6c14022ca88611aff2365cbe4f30c (patch)
treef3312bbf41165733b8edc111618bf82b38cd3cec /tests
parentbd078146c3b2ab4fb8011e67d9d5c9016bb9d09b (diff)
downloadhorizon-0d626d668ba6c14022ca88611aff2365cbe4f30c.tar.gz
horizon-0d626d668ba6c14022ca88611aff2365cbe4f30c.tar.bz2
horizon-0d626d668ba6c14022ca88611aff2365cbe4f30c.tar.xz
horizon-0d626d668ba6c14022ca88611aff2365cbe4f30c.zip
hscript: Implement lvm_lv, add tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0171-lvmlv-basic.installfile12
-rw-r--r--tests/fixtures/0172-lvmlv-badvg.installfile12
-rw-r--r--tests/fixtures/0173-lvmlv-badlv.installfile12
-rw-r--r--tests/fixtures/0174-lvmlv-bad-size.installfile12
-rw-r--r--tests/fixtures/0175-lvmlv-invalid.installfile12
-rw-r--r--tests/fixtures/0176-lvmlv-duplicate.installfile13
-rw-r--r--tests/fixtures/0177-lvmlv-no-vg.installfile6
-rw-r--r--tests/spec/validator_spec.rb39
8 files changed, 118 insertions, 0 deletions
diff --git a/tests/fixtures/0171-lvmlv-basic.installfile b/tests/fixtures/0171-lvmlv-basic.installfile
new file mode 100644
index 0000000..8c5e4d8
--- /dev/null
+++ b/tests/fixtures/0171-lvmlv-basic.installfile
@@ -0,0 +1,12 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sdb WDC
+disklabel /dev/sdb apm
+partition /dev/sdb 1 8M boot
+partition /dev/sdb 2 fill
+lvm_pv /dev/sdb2
+lvm_vg /dev/sdb2 MyVolGroup
+lvm_lv MyVolGroup root fill
diff --git a/tests/fixtures/0172-lvmlv-badvg.installfile b/tests/fixtures/0172-lvmlv-badvg.installfile
new file mode 100644
index 0000000..fe28560
--- /dev/null
+++ b/tests/fixtures/0172-lvmlv-badvg.installfile
@@ -0,0 +1,12 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sdb WDC
+disklabel /dev/sdb apm
+partition /dev/sdb 1 8M boot
+partition /dev/sdb 2 fill
+lvm_pv /dev/sdb2
+lvm_vg /dev/sdb2 MyVolGroup
+lvm_lv -MyVolGroup root fill
diff --git a/tests/fixtures/0173-lvmlv-badlv.installfile b/tests/fixtures/0173-lvmlv-badlv.installfile
new file mode 100644
index 0000000..da20e5e
--- /dev/null
+++ b/tests/fixtures/0173-lvmlv-badlv.installfile
@@ -0,0 +1,12 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sdb WDC
+disklabel /dev/sdb apm
+partition /dev/sdb 1 8M boot
+partition /dev/sdb 2 fill
+lvm_pv /dev/sdb2
+lvm_vg /dev/sdb2 MyVolGroup
+lvm_lv MyVolGroup xml_cdata fill
diff --git a/tests/fixtures/0174-lvmlv-bad-size.installfile b/tests/fixtures/0174-lvmlv-bad-size.installfile
new file mode 100644
index 0000000..8cf747e
--- /dev/null
+++ b/tests/fixtures/0174-lvmlv-bad-size.installfile
@@ -0,0 +1,12 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sdb WDC
+disklabel /dev/sdb apm
+partition /dev/sdb 1 8M boot
+partition /dev/sdb 2 fill
+lvm_pv /dev/sdb2
+lvm_vg /dev/sdb2 MyVolGroup
+lvm_lv MyVolGroup root 9Z
diff --git a/tests/fixtures/0175-lvmlv-invalid.installfile b/tests/fixtures/0175-lvmlv-invalid.installfile
new file mode 100644
index 0000000..74bf7ab
--- /dev/null
+++ b/tests/fixtures/0175-lvmlv-invalid.installfile
@@ -0,0 +1,12 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sdb WDC
+disklabel /dev/sdb apm
+partition /dev/sdb 1 8M boot
+partition /dev/sdb 2 fill
+lvm_pv /dev/sdb2
+lvm_vg /dev/sdb2 MyVolGroup
+lvm_lv MyVolGroup root
diff --git a/tests/fixtures/0176-lvmlv-duplicate.installfile b/tests/fixtures/0176-lvmlv-duplicate.installfile
new file mode 100644
index 0000000..c5045bb
--- /dev/null
+++ b/tests/fixtures/0176-lvmlv-duplicate.installfile
@@ -0,0 +1,13 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sdb WDC
+disklabel /dev/sdb apm
+partition /dev/sdb 1 8M boot
+partition /dev/sdb 2 fill
+lvm_pv /dev/sdb2
+lvm_vg /dev/sdb2 MyVolGroup
+lvm_lv MyVolGroup root fill
+lvm_lv MyVolGroup root fill
diff --git a/tests/fixtures/0177-lvmlv-no-vg.installfile b/tests/fixtures/0177-lvmlv-no-vg.installfile
new file mode 100644
index 0000000..509f258
--- /dev/null
+++ b/tests/fixtures/0177-lvmlv-no-vg.installfile
@@ -0,0 +1,6 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+lvm_lv NonExistentGroup root fill
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index 0443140..21def58 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -834,6 +834,45 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*lvm_vg.*expected/)
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
+ end
end
context "unique keys" do
# Runner.Validate.network.