From 6209b9c9f77af5f7ca0618a44bfd0b5955d7d678 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 23 Jun 2020 20:07:41 -0500 Subject: hscript: Implement runlevel support in svcenable key --- tests/fixtures/0239-svcenable-runlevel.installfile | 7 +++++++ tests/fixtures/0240-bootloader-invalid.installfile | 7 +++++++ tests/spec/simulator_spec.rb | 7 ++++++- tests/spec/validator_spec.rb | 6 ++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/0239-svcenable-runlevel.installfile create mode 100644 tests/fixtures/0240-bootloader-invalid.installfile (limited to 'tests') diff --git a/tests/fixtures/0239-svcenable-runlevel.installfile b/tests/fixtures/0239-svcenable-runlevel.installfile new file mode 100644 index 0000000..b1b35b6 --- /dev/null +++ b/tests/fixtures/0239-svcenable-runlevel.installfile @@ -0,0 +1,7 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +svcenable sshd +svcenable udev boot diff --git a/tests/fixtures/0240-bootloader-invalid.installfile b/tests/fixtures/0240-bootloader-invalid.installfile new file mode 100644 index 0000000..210fe7f --- /dev/null +++ b/tests/fixtures/0240-bootloader-invalid.installfile @@ -0,0 +1,7 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +arch ppc64 +bootloader grub-efi diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb index 161fd12..bded726 100644 --- a/tests/spec/simulator_spec.rb +++ b/tests/spec/simulator_spec.rb @@ -32,7 +32,7 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do end end it "handles validation failures correctly" do - use_fixture '0024-numeric-hostname.installfile' + use_fixture '0240-bootloader-invalid.installfile' run_simulate expect(last_command_started.stderr).to include("Script failed. Stop.") end @@ -280,6 +280,11 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >> run_simulate expect(last_command_started.stdout).to include("ln -s /etc/init.d/sshd /target/etc/runlevels/default/sshd") end + it "handles runlevels correctly" do + use_fixture '0239-svcenable-runlevel.installfile' + run_simulate + expect(last_command_started.stdout).to include("ln -s /etc/init.d/udev /target/etc/runlevels/boot/udev") + end end context "simulating 'pkginstall' execution" do # Runner.Execute.pkginstall.APKDB diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index a5e11e6..8fb6c95 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -687,6 +687,12 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do run_validate expect(last_command_started).to have_output(/error: .*svcenable.*invalid/) end + it "succeeds with a runlevel specified" do + use_fixture '0239-svcenable-runlevel.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end end context "for 'diskid' key" do it "succeeds with basic disk identification" do -- cgit v1.2.3-60-g2f50