From cd2ab0ea31fd4dc9305c1d5e08100eafaff19f7e Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 26 Oct 2019 01:09:57 -0500 Subject: hscript: Implement lvm_pv, add tests --- tests/fixtures/0163-lvmpv-basic.installfile | 10 ++++++++++ tests/fixtures/0164-lvmpv-invalid.installfile | 10 ++++++++++ tests/fixtures/0165-lvmpv-duplicate.installfile | 11 +++++++++++ tests/spec/validator_spec.rb | 18 ++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 tests/fixtures/0163-lvmpv-basic.installfile create mode 100644 tests/fixtures/0164-lvmpv-invalid.installfile create mode 100644 tests/fixtures/0165-lvmpv-duplicate.installfile (limited to 'tests') 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. -- cgit v1.2.3-60-g2f50