summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-12 00:15:48 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-12 00:15:48 -0500
commit47558ea71d523fb71307d394be4bfad8da4664d8 (patch)
tree98016963b7a702acfbbe42da1e93a37b7286479f /tests
parent736d495d637035783380973b69df043e0263e9d8 (diff)
downloadhorizon-47558ea71d523fb71307d394be4bfad8da4664d8.tar.gz
horizon-47558ea71d523fb71307d394be4bfad8da4664d8.tar.bz2
horizon-47558ea71d523fb71307d394be4bfad8da4664d8.tar.xz
horizon-47558ea71d523fb71307d394be4bfad8da4664d8.zip
hscript: Parse 'mount' key, add tests to ensure
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0027-mount-invalid-dev.installfile5
-rw-r--r--tests/fixtures/0028-mount-non-absolute.installfile5
-rw-r--r--tests/fixtures/0029-mount-too-many.installfile5
-rw-r--r--tests/fixtures/0030-mount-too-few.installfile5
-rw-r--r--tests/spec/validator.rb30
5 files changed, 50 insertions, 0 deletions
diff --git a/tests/fixtures/0027-mount-invalid-dev.installfile b/tests/fixtures/0027-mount-invalid-dev.installfile
new file mode 100644
index 0000000..22c65df
--- /dev/null
+++ b/tests/fixtures/0027-mount-invalid-dev.installfile
@@ -0,0 +1,5 @@
+network true
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount nonexistant /
diff --git a/tests/fixtures/0028-mount-non-absolute.installfile b/tests/fixtures/0028-mount-non-absolute.installfile
new file mode 100644
index 0000000..b7932ac
--- /dev/null
+++ b/tests/fixtures/0028-mount-non-absolute.installfile
@@ -0,0 +1,5 @@
+network true
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 usr
diff --git a/tests/fixtures/0029-mount-too-many.installfile b/tests/fixtures/0029-mount-too-many.installfile
new file mode 100644
index 0000000..6b1b221
--- /dev/null
+++ b/tests/fixtures/0029-mount-too-many.installfile
@@ -0,0 +1,5 @@
+network true
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 / relatime Cat
diff --git a/tests/fixtures/0030-mount-too-few.installfile b/tests/fixtures/0030-mount-too-few.installfile
new file mode 100644
index 0000000..0f11c37
--- /dev/null
+++ b/tests/fixtures/0030-mount-too-few.installfile
@@ -0,0 +1,5 @@
+network true
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1
diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb
index 497db58..b1cd2ab 100644
--- a/tests/spec/validator.rb
+++ b/tests/spec/validator.rb
@@ -152,6 +152,36 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*mount.*/)
end
+ # Runner.Validate.mount.
+ it "fails with too many values in 'mount' tuple" do
+ use_fixture '0029-mount-too-many.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*mount.*elements/)
+ end
+ # Runner.Validate.mount.
+ it "fails with too few values in 'mount' tuple" do
+ use_fixture '0030-mount-too-few.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*mount.*elements/)
+ end
+ # Runner.Validate.mount.Block.
+ it "fails with a 'mount' value that has no block device" do
+ use_fixture '0027-mount-invalid-dev.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*mount.*device/)
+ end
+ # Runner.Validate.mount.Point.
+ it "fails with a 'mount' value that has an invalid mountpoint" do
+ use_fixture '0028-mount-non-absolute.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*mount.*path/)
+ end
+ # Runner.Validate.mount.Unique.
+ it "fails with two root 'mount' keys" do
+ use_fixture '0021-duplicate-root-mount.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*mount.*duplicate/)
+ end
end
context "unique keys" do
# Runner.Validate.network.