summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-19 21:35:27 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-19 21:35:27 -0500
commit02a2ad393de6cbea726514226e3419db6517307c (patch)
tree000fb00ec7ec9a4a963a21ae3e2a770a5de8179f /tests
parentf1ef45bd84b57b40b701e094a9b49daac3761f9f (diff)
downloadhorizon-02a2ad393de6cbea726514226e3419db6517307c.tar.gz
horizon-02a2ad393de6cbea726514226e3419db6517307c.tar.bz2
horizon-02a2ad393de6cbea726514226e3419db6517307c.tar.xz
horizon-02a2ad393de6cbea726514226e3419db6517307c.zip
hscript: Implement Firmware, and add tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0111-firmware-true.installfile6
-rw-r--r--tests/fixtures/0112-firmware-false.installfile6
-rw-r--r--tests/fixtures/0113-firmware-invalid.installfile7
-rw-r--r--tests/fixtures/0114-firmware-duplicate.installfile7
-rw-r--r--tests/spec/validator.rb33
5 files changed, 59 insertions, 0 deletions
diff --git a/tests/fixtures/0111-firmware-true.installfile b/tests/fixtures/0111-firmware-true.installfile
new file mode 100644
index 0000000..a2d5ead
--- /dev/null
+++ b/tests/fixtures/0111-firmware-true.installfile
@@ -0,0 +1,6 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+firmware true
diff --git a/tests/fixtures/0112-firmware-false.installfile b/tests/fixtures/0112-firmware-false.installfile
new file mode 100644
index 0000000..9abc556
--- /dev/null
+++ b/tests/fixtures/0112-firmware-false.installfile
@@ -0,0 +1,6 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+firmware false
diff --git a/tests/fixtures/0113-firmware-invalid.installfile b/tests/fixtures/0113-firmware-invalid.installfile
new file mode 100644
index 0000000..b823be1
--- /dev/null
+++ b/tests/fixtures/0113-firmware-invalid.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+# Intentional misspelling
+firmware fasle
diff --git a/tests/fixtures/0114-firmware-duplicate.installfile b/tests/fixtures/0114-firmware-duplicate.installfile
new file mode 100644
index 0000000..372c645
--- /dev/null
+++ b/tests/fixtures/0114-firmware-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+firmware false
+firmware false
diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb
index 023d49e..0a94dbf 100644
--- a/tests/spec/validator.rb
+++ b/tests/spec/validator.rb
@@ -166,6 +166,32 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*rootpw.*/)
end
+ context "for 'firmware' key" do
+ it "always supports 'false' value" do
+ use_fixture '0112-firmware-false.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "requires 'false' if built without support" do
+ use_fixture '0111-firmware-true.installfile'
+ run_validate
+ skip "This build supports firmware" if last_command_started.stdout =~ /supports non-free/
+ expect(last_command_started).to have_output(/error: .*firmware/)
+ end
+ it "supports 'true' if built with support" do
+ use_fixture '0111-firmware-true.installfile'
+ run_validate
+ skip "This build does not support firmware" if last_command_started.stdout !~ /supports non-free/
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "requires a boolean value" do
+ use_fixture '0113-firmware-invalid.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*firmware.*value/)
+ end
+ end
context "for 'mount' key" do
# Runner.Validate.mount.
it "fails with an invalid value" do
@@ -507,6 +533,13 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*duplicate.*rootpw/)
end
+ # Runner.Validate.firmware.
+ it "fails with a duplicate 'firmware' key" do
+ use_fixture '0114-firmware-duplicate.installfile'
+ run_validate
+ skip "This build does not support firmware" if last_command_started.stdout !~ /supports non-free/
+ expect(last_command_started).to have_output(/error: .*duplicate.*firmware/)
+ end
end
context "user account keys:" do
context "'username'" do