diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/0076-diskid-basic.installfile | 6 | ||||
-rw-r--r-- | tests/fixtures/0077-diskid-missing-id.installfile | 6 | ||||
-rw-r--r-- | tests/fixtures/0078-diskid-diskid-loop0.installfile | 6 | ||||
-rw-r--r-- | tests/fixtures/0079-diskid-enoent.installfile | 6 | ||||
-rw-r--r-- | tests/fixtures/0080-diskid-tmp.installfile | 6 | ||||
-rw-r--r-- | tests/fixtures/0081-diskid-duplicate.installfile | 7 | ||||
-rw-r--r-- | tests/spec/validator.rb | 34 |
7 files changed, 71 insertions, 0 deletions
diff --git a/tests/fixtures/0076-diskid-basic.installfile b/tests/fixtures/0076-diskid-basic.installfile new file mode 100644 index 0000000..329e70c --- /dev/null +++ b/tests/fixtures/0076-diskid-basic.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +diskid /dev/sda SEAGATE diff --git a/tests/fixtures/0077-diskid-missing-id.installfile b/tests/fixtures/0077-diskid-missing-id.installfile new file mode 100644 index 0000000..d98623c --- /dev/null +++ b/tests/fixtures/0077-diskid-missing-id.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +diskid /dev/nvme0n1 diff --git a/tests/fixtures/0078-diskid-diskid-loop0.installfile b/tests/fixtures/0078-diskid-diskid-loop0.installfile new file mode 100644 index 0000000..a653295 --- /dev/null +++ b/tests/fixtures/0078-diskid-diskid-loop0.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +diskid /dev/loop0 Loop diff --git a/tests/fixtures/0079-diskid-enoent.installfile b/tests/fixtures/0079-diskid-enoent.installfile new file mode 100644 index 0000000..52bca60 --- /dev/null +++ b/tests/fixtures/0079-diskid-enoent.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +diskid /path/doesnt/exist Test diff --git a/tests/fixtures/0080-diskid-tmp.installfile b/tests/fixtures/0080-diskid-tmp.installfile new file mode 100644 index 0000000..0aab4cd --- /dev/null +++ b/tests/fixtures/0080-diskid-tmp.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +diskid /tmp This will error because it isn't a block device diff --git a/tests/fixtures/0081-diskid-duplicate.installfile b/tests/fixtures/0081-diskid-duplicate.installfile new file mode 100644 index 0000000..1fe96b1 --- /dev/null +++ b/tests/fixtures/0081-diskid-duplicate.installfile @@ -0,0 +1,7 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +diskid /dev/sda SEAGATE +diskid /dev/sda WD diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb index cdcd38b..d54006d 100644 --- a/tests/spec/validator.rb +++ b/tests/spec/validator.rb @@ -450,6 +450,40 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do expect(last_command_started).to have_output(/error: .*repository/) 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' + 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' + 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' + 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 end context "unique keys" do # Runner.Validate.network. |