summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-06 17:48:33 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-06 17:48:33 -0600
commitd799d56fc8505261cda099f402eafbc4fe858ca0 (patch)
treee39fa61b72b058dd176dd30f89730985a0f0b6f7 /tests
parent8b7d518575604e628e3823f6bf1b7dd1ee36cc1d (diff)
downloadhorizon-d799d56fc8505261cda099f402eafbc4fe858ca0.tar.gz
horizon-d799d56fc8505261cda099f402eafbc4fe858ca0.tar.bz2
horizon-d799d56fc8505261cda099f402eafbc4fe858ca0.tar.xz
horizon-d799d56fc8505261cda099f402eafbc4fe858ca0.zip
tests: Add more LVM behavioural tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0207-lvmvg-dot.installfile11
-rw-r--r--tests/fixtures/0208-lvmvg-valid-dot.installfile11
-rw-r--r--tests/fixtures/0209-lvmlv-dash.installfile12
-rw-r--r--tests/fixtures/0210-lvmlv-snapshot.installfile12
-rw-r--r--tests/fixtures/0211-lvmlv-pvmove.installfile12
-rw-r--r--tests/fixtures/0212-lvmlv-size-percent.installfile12
-rw-r--r--tests/fixtures/0213-lvmlv-size-bytes.installfile12
-rw-r--r--tests/fixtures/0214-lvmvg-without-pv.installfile10
-rw-r--r--tests/spec/simulator_spec.rb10
-rw-r--r--tests/spec/validator_spec.rb29
10 files changed, 131 insertions, 0 deletions
diff --git a/tests/fixtures/0207-lvmvg-dot.installfile b/tests/fixtures/0207-lvmvg-dot.installfile
new file mode 100644
index 0000000..9e53375
--- /dev/null
+++ b/tests/fixtures/0207-lvmvg-dot.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_vg /dev/sdb2 .
diff --git a/tests/fixtures/0208-lvmvg-valid-dot.installfile b/tests/fixtures/0208-lvmvg-valid-dot.installfile
new file mode 100644
index 0000000..e973fc8
--- /dev/null
+++ b/tests/fixtures/0208-lvmvg-valid-dot.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_vg /dev/sdb2 .MyVolGroup
diff --git a/tests/fixtures/0209-lvmlv-dash.installfile b/tests/fixtures/0209-lvmlv-dash.installfile
new file mode 100644
index 0000000..0e5b281
--- /dev/null
+++ b/tests/fixtures/0209-lvmlv-dash.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/0210-lvmlv-snapshot.installfile b/tests/fixtures/0210-lvmlv-snapshot.installfile
new file mode 100644
index 0000000..be065ef
--- /dev/null
+++ b/tests/fixtures/0210-lvmlv-snapshot.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 snapshot fill
diff --git a/tests/fixtures/0211-lvmlv-pvmove.installfile b/tests/fixtures/0211-lvmlv-pvmove.installfile
new file mode 100644
index 0000000..01de128
--- /dev/null
+++ b/tests/fixtures/0211-lvmlv-pvmove.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 pvmove fill
diff --git a/tests/fixtures/0212-lvmlv-size-percent.installfile b/tests/fixtures/0212-lvmlv-size-percent.installfile
new file mode 100644
index 0000000..787044d
--- /dev/null
+++ b/tests/fixtures/0212-lvmlv-size-percent.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 50%
diff --git a/tests/fixtures/0213-lvmlv-size-bytes.installfile b/tests/fixtures/0213-lvmlv-size-bytes.installfile
new file mode 100644
index 0000000..9823b52
--- /dev/null
+++ b/tests/fixtures/0213-lvmlv-size-bytes.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 100M
diff --git a/tests/fixtures/0214-lvmvg-without-pv.installfile b/tests/fixtures/0214-lvmvg-without-pv.installfile
new file mode 100644
index 0000000..0e0082c
--- /dev/null
+++ b/tests/fixtures/0214-lvmvg-without-pv.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_vg /dev/loop2 NonExistentVG
diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb
index e5eeb52..1507428 100644
--- a/tests/spec/simulator_spec.rb
+++ b/tests/spec/simulator_spec.rb
@@ -64,6 +64,16 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do
run_simulate
expect(last_command_started.stdout).to include("lvcreate -l 100%FREE -n root MyVolGroup")
end
+ it "supports percentage sizing" do
+ use_fixture '0212-lvmlv-size-percent.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("lvcreate -l 50%VG -n root MyVolGroup")
+ end
+ it "supports byte sizing" do
+ use_fixture '0213-lvmlv-size-bytes.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("lvcreate -L 104857600B -n root MyVolGroup")
+ end
end
context "simulating 'fs' execution" do
it "creates ext2 filesystems correctly" do
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index ba5559f..37a2542 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -890,6 +890,22 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
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
@@ -929,6 +945,19 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
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