summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-21 01:36:47 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-21 01:36:47 -0500
commit07a2de27b57848789171dee2559e4bd78d0e921c (patch)
tree67f4a95dc146a09207f293feccb6555063c6f955 /tests
parent790217353e94a4a9ee14d51b8a9e6c2dafc6377d (diff)
downloadhorizon-07a2de27b57848789171dee2559e4bd78d0e921c.tar.gz
horizon-07a2de27b57848789171dee2559e4bd78d0e921c.tar.bz2
horizon-07a2de27b57848789171dee2559e4bd78d0e921c.tar.xz
horizon-07a2de27b57848789171dee2559e4bd78d0e921c.zip
hscript: Implement DiskLabel, add tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0076-diskid-basic.installfile2
-rw-r--r--tests/fixtures/0122-disklabel-apm.installfile7
-rw-r--r--tests/fixtures/0123-disklabel-mbr.installfile7
-rw-r--r--tests/fixtures/0124-disklabel-gpt.installfile7
-rw-r--r--tests/fixtures/0125-disklabel-duplicate.installfile8
-rw-r--r--tests/fixtures/0126-disklabel-loop0.installfile6
-rw-r--r--tests/fixtures/0127-disklabel-enoent.installfile6
-rw-r--r--tests/fixtures/0128-disklabel-invalid-type.installfile7
-rw-r--r--tests/fixtures/0129-disklabel-without-label.installfile7
-rw-r--r--tests/spec/validator_spec.rb48
10 files changed, 104 insertions, 1 deletions
diff --git a/tests/fixtures/0076-diskid-basic.installfile b/tests/fixtures/0076-diskid-basic.installfile
index 329e70c..611428c 100644
--- a/tests/fixtures/0076-diskid-basic.installfile
+++ b/tests/fixtures/0076-diskid-basic.installfile
@@ -3,4 +3,4 @@ hostname test.machine
pkginstall adelie-base
rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
mount /dev/sda1 /
-diskid /dev/sda SEAGATE
+diskid /dev/sda ST1000
diff --git a/tests/fixtures/0122-disklabel-apm.installfile b/tests/fixtures/0122-disklabel-apm.installfile
new file mode 100644
index 0000000..8acb90b
--- /dev/null
+++ b/tests/fixtures/0122-disklabel-apm.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 ST1000
+disklabel /dev/sda apm
diff --git a/tests/fixtures/0123-disklabel-mbr.installfile b/tests/fixtures/0123-disklabel-mbr.installfile
new file mode 100644
index 0000000..f865628
--- /dev/null
+++ b/tests/fixtures/0123-disklabel-mbr.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 ST1000
+disklabel /dev/sda mbr
diff --git a/tests/fixtures/0124-disklabel-gpt.installfile b/tests/fixtures/0124-disklabel-gpt.installfile
new file mode 100644
index 0000000..d793970
--- /dev/null
+++ b/tests/fixtures/0124-disklabel-gpt.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 ST1000
+disklabel /dev/sda gpt
diff --git a/tests/fixtures/0125-disklabel-duplicate.installfile b/tests/fixtures/0125-disklabel-duplicate.installfile
new file mode 100644
index 0000000..2a2b7e2
--- /dev/null
+++ b/tests/fixtures/0125-disklabel-duplicate.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+diskid /dev/sda ST1000
+disklabel /dev/sda apm
+disklabel /dev/sda gpt
diff --git a/tests/fixtures/0126-disklabel-loop0.installfile b/tests/fixtures/0126-disklabel-loop0.installfile
new file mode 100644
index 0000000..cead2fd
--- /dev/null
+++ b/tests/fixtures/0126-disklabel-loop0.installfile
@@ -0,0 +1,6 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+disklabel /dev/loop0 apm
diff --git a/tests/fixtures/0127-disklabel-enoent.installfile b/tests/fixtures/0127-disklabel-enoent.installfile
new file mode 100644
index 0000000..9a5835c
--- /dev/null
+++ b/tests/fixtures/0127-disklabel-enoent.installfile
@@ -0,0 +1,6 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+disklabel /tmp gpt
diff --git a/tests/fixtures/0128-disklabel-invalid-type.installfile b/tests/fixtures/0128-disklabel-invalid-type.installfile
new file mode 100644
index 0000000..b4c14b2
--- /dev/null
+++ b/tests/fixtures/0128-disklabel-invalid-type.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 ST1000
+disklabel /dev/sda sun
diff --git a/tests/fixtures/0129-disklabel-without-label.installfile b/tests/fixtures/0129-disklabel-without-label.installfile
new file mode 100644
index 0000000..5c6455c
--- /dev/null
+++ b/tests/fixtures/0129-disklabel-without-label.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 ST1000
+disklabel /dev/sda
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index 3ed43ea..624eaa2 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -548,6 +548,54 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*diskid.*already/)
end
end
+ context "for 'disklabel' key" do
+ it "requires a label type" do
+ use_fixture '0129-disklabel-without-label.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*disklabel.*expected/)
+ end
+ it "succeeds with a APM disk label" do
+ use_fixture '0122-disklabel-apm.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "succeeds with a MBR disk label" do
+ use_fixture '0123-disklabel-mbr.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "succeeds with a GPT disk label" do
+ use_fixture '0124-disklabel-gpt.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 duplicate disk" do
+ use_fixture '0125-disklabel-duplicate.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*disklabel.*already/)
+ end
+ it "succeeds with present disk" do
+ use_fixture '0126-disklabel-loop0.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(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "fails with non-present disk" do
+ use_fixture '0127-disklabel-enoent.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: .*disklabel.*block/)
+ end
+ it "requires a valid label type" do
+ use_fixture '0128-disklabel-invalid-type.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*disklabel.*type/)
+ end
+ end
end
context "unique keys" do
# Runner.Validate.network.