From 1bb0933fbca5ea5e07d0466b6a599b2d517402d3 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 6 Nov 2019 18:37:42 -0600 Subject: tests: Add pkginstall duplicate package tests --- tests/fixtures/0216-pkginstall-dup-single.installfile | 5 +++++ tests/fixtures/0217-pkginstall-dup-multi.installfile | 6 ++++++ tests/spec/validator_spec.rb | 12 ++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/fixtures/0216-pkginstall-dup-single.installfile create mode 100644 tests/fixtures/0217-pkginstall-dup-multi.installfile (limited to 'tests') diff --git a/tests/fixtures/0216-pkginstall-dup-single.installfile b/tests/fixtures/0216-pkginstall-dup-single.installfile new file mode 100644 index 0000000..e7d505e --- /dev/null +++ b/tests/fixtures/0216-pkginstall-dup-single.installfile @@ -0,0 +1,5 @@ +network false +hostname test.machine +pkginstall adelie-base openrc openrc +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / diff --git a/tests/fixtures/0217-pkginstall-dup-multi.installfile b/tests/fixtures/0217-pkginstall-dup-multi.installfile new file mode 100644 index 0000000..16867d0 --- /dev/null +++ b/tests/fixtures/0217-pkginstall-dup-multi.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base openrc +pkginstall netifrc openrc +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index 121ee22..45bb949 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -601,6 +601,18 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do expect(last_command_started).to have_output(/error: .*signingkey/) end end + context "for 'pkginstall' key" do + it "warns when a package is listed twice in the same line" do + use_fixture '0216-pkginstall-dup-single.installfile' + run_validate + expect(last_command_started).to have_output(/warning: .*pkginstall.*already/) + end + it "warns when a package is listed twice in the same script" do + use_fixture '0217-pkginstall-dup-multi.installfile' + run_validate ' -s' + expect(last_command_started).to have_output(/warning: .*pkginstall.*already/) + end + end context "for 'diskid' key" do it "succeeds with basic disk identification" do use_fixture '0076-diskid-basic.installfile' -- cgit v1.2.3-60-g2f50