summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 18:03:00 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 18:03:00 -0500
commitf97ac86dc0dadc20b53d66dade311e4b4e50b7fc (patch)
treea40a77feec79df0169a8e322e3f93febaba89bbc /tests
parentcce8d9ba1541ef977260472d54461019e0e415ae (diff)
downloadhorizon-f97ac86dc0dadc20b53d66dade311e4b4e50b7fc.tar.gz
horizon-f97ac86dc0dadc20b53d66dade311e4b4e50b7fc.tar.bz2
horizon-f97ac86dc0dadc20b53d66dade311e4b4e50b7fc.tar.xz
horizon-f97ac86dc0dadc20b53d66dade311e4b4e50b7fc.zip
hscript: Implement fs, add tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0179-fs-basic.installfile9
-rw-r--r--tests/fixtures/0180-fs-without-fs.installfile9
-rw-r--r--tests/fixtures/0181-fs-invalid-dev.installfile9
-rw-r--r--tests/fixtures/0182-fs-invalid-type.installfile9
-rw-r--r--tests/spec/validator_spec.rb23
5 files changed, 59 insertions, 0 deletions
diff --git a/tests/fixtures/0179-fs-basic.installfile b/tests/fixtures/0179-fs-basic.installfile
new file mode 100644
index 0000000..6990c07
--- /dev/null
+++ b/tests/fixtures/0179-fs-basic.installfile
@@ -0,0 +1,9 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+diskid /dev/sdb WDBNCE2500PNC
+disklabel /dev/sdb gpt
+partition /dev/sdb 1 fill
+fs /dev/sdb1 ext4
+mount /dev/sdb1 /
diff --git a/tests/fixtures/0180-fs-without-fs.installfile b/tests/fixtures/0180-fs-without-fs.installfile
new file mode 100644
index 0000000..f113018
--- /dev/null
+++ b/tests/fixtures/0180-fs-without-fs.installfile
@@ -0,0 +1,9 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+diskid /dev/sdb WDBNCE2500PNC
+disklabel /dev/sdb gpt
+partition /dev/sdb 1 fill
+fs /dev/sdb1
+mount /dev/sdb1 /
diff --git a/tests/fixtures/0181-fs-invalid-dev.installfile b/tests/fixtures/0181-fs-invalid-dev.installfile
new file mode 100644
index 0000000..5a3a67f
--- /dev/null
+++ b/tests/fixtures/0181-fs-invalid-dev.installfile
@@ -0,0 +1,9 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+diskid /dev/sdb WDBNCE2500PNC
+disklabel /dev/sdb gpt
+partition /dev/sdb 1 fill
+fs sdb1 ext4
+mount /dev/sdb1 /
diff --git a/tests/fixtures/0182-fs-invalid-type.installfile b/tests/fixtures/0182-fs-invalid-type.installfile
new file mode 100644
index 0000000..4a88048
--- /dev/null
+++ b/tests/fixtures/0182-fs-invalid-type.installfile
@@ -0,0 +1,9 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+diskid /dev/sdb WDBNCE2500PNC
+disklabel /dev/sdb gpt
+partition /dev/sdb 1 fill
+fs /dev/sdb1 ntfs
+mount /dev/sdb1 /
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index c4e5ac2..c36e5a1 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -873,6 +873,29 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*lvm_lv.*volume group/)
end
end
+ context "for 'fs' key" do
+ it "succeeds with a simple value" do
+ use_fixture '0179-fs-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 a filesystem type" do
+ use_fixture '0180-fs-without-fs.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*fs.*expected/)
+ end
+ it "requires a valid absolute block device path" do
+ use_fixture '0181-fs-invalid-dev.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*fs.*device/)
+ end
+ it "requires a valid filesystem type" do
+ use_fixture '0182-fs-invalid-type.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*fs.*type/)
+ end
+ end
context "for 'keymap' key" do
it "succeeds with a simple value" do
use_fixture '0178-keymap-basic.installfile'