summaryrefslogtreecommitdiff
path: root/tests/spec
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-19 17:14:27 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-19 17:14:27 -0600
commit2495654ac0b1d9a4002f8d385d10d2afec784dda (patch)
treeda8b25a9bbaa3ab3bc2901398db4a0a3ec74481c /tests/spec
parent3744e909df78cefebb083e401f6f6378f27d1b1a (diff)
downloadhorizon-2495654ac0b1d9a4002f8d385d10d2afec784dda.tar.gz
horizon-2495654ac0b1d9a4002f8d385d10d2afec784dda.tar.bz2
horizon-2495654ac0b1d9a4002f8d385d10d2afec784dda.tar.xz
horizon-2495654ac0b1d9a4002f8d385d10d2afec784dda.zip
hscript: Add 'arch' key implementation and related tests
Diffstat (limited to 'tests/spec')
-rw-r--r--tests/spec/simulator_spec.rb7
-rw-r--r--tests/spec/validator_spec.rb18
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb
index df2b2ae..67177c2 100644
--- a/tests/spec/simulator_spec.rb
+++ b/tests/spec/simulator_spec.rb
@@ -156,6 +156,13 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
expect(last_command_started.stderr).to include("set domain name 'we-sing-it-proudly.new-romantics.club'")
end
end
+ context "simulating 'arch' execution" do
+ it "sets the architecture properly" do
+ use_fixture '0223-arch-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("printf 'ppc64\\n' > /target/etc/apk/arch")
+ end
+ end
context "simulating 'repository' execution" do
it "outputs default repositories when none are specified" do
use_fixture '0001-basic.installfile'
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index eea3f2a..ba38563 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -203,6 +203,24 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*language.*invalid/)
end
end
+ context "for 'arch' key" do
+ it "succeeds with valid architecture" do
+ use_fixture '0223-arch-basic.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "warns on unrecognised architecture" do
+ use_fixture '0224-arch-unknown.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/warning: .*arch.*unknown CPU/)
+ end
+ it "fails on malformed architecture name" do
+ use_fixture '0225-arch-invalid.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*arch.*expected/)
+ end
+ end
context "for 'nameserver' key" do
it "succeeds with IPv4 and IPv6 addresses" do
use_fixture '0183-nameserver-basic.installfile'