summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-26 01:09:57 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-26 01:09:57 -0500
commitcd2ab0ea31fd4dc9305c1d5e08100eafaff19f7e (patch)
tree56f0f158ae77150952014557b716986199ad4938 /tests
parenta5da0c07e7202f44b03acfc1324fb410bff94496 (diff)
downloadhorizon-cd2ab0ea31fd4dc9305c1d5e08100eafaff19f7e.tar.gz
horizon-cd2ab0ea31fd4dc9305c1d5e08100eafaff19f7e.tar.bz2
horizon-cd2ab0ea31fd4dc9305c1d5e08100eafaff19f7e.tar.xz
horizon-cd2ab0ea31fd4dc9305c1d5e08100eafaff19f7e.zip
hscript: Implement lvm_pv, add tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0163-lvmpv-basic.installfile10
-rw-r--r--tests/fixtures/0164-lvmpv-invalid.installfile10
-rw-r--r--tests/fixtures/0165-lvmpv-duplicate.installfile11
-rw-r--r--tests/spec/validator_spec.rb18
4 files changed, 49 insertions, 0 deletions
diff --git a/tests/fixtures/0163-lvmpv-basic.installfile b/tests/fixtures/0163-lvmpv-basic.installfile
new file mode 100644
index 0000000..9712ccd
--- /dev/null
+++ b/tests/fixtures/0163-lvmpv-basic.installfile
@@ -0,0 +1,10 @@
+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
diff --git a/tests/fixtures/0164-lvmpv-invalid.installfile b/tests/fixtures/0164-lvmpv-invalid.installfile
new file mode 100644
index 0000000..3abe2e5
--- /dev/null
+++ b/tests/fixtures/0164-lvmpv-invalid.installfile
@@ -0,0 +1,10 @@
+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 sdb2
diff --git a/tests/fixtures/0165-lvmpv-duplicate.installfile b/tests/fixtures/0165-lvmpv-duplicate.installfile
new file mode 100644
index 0000000..1ec5ed8
--- /dev/null
+++ b/tests/fixtures/0165-lvmpv-duplicate.installfile
@@ -0,0 +1,11 @@
+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_pv /dev/sdb2
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index df504ca..976f0f6 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -788,6 +788,24 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
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
end
context "unique keys" do
# Runner.Validate.network.