diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 21:41:24 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 21:41:24 -0500 |
commit | decc6e87d9ab84aac5a000937d7e19f2fcefd911 (patch) | |
tree | 49e77212fc895e059bbed44a90a16b9d5773647a /tests | |
parent | 3e948338a90dd6bd0ddc2582cf37c908f3611c56 (diff) | |
download | horizon-decc6e87d9ab84aac5a000937d7e19f2fcefd911.tar.gz horizon-decc6e87d9ab84aac5a000937d7e19f2fcefd911.tar.bz2 horizon-decc6e87d9ab84aac5a000937d7e19f2fcefd911.tar.xz horizon-decc6e87d9ab84aac5a000937d7e19f2fcefd911.zip |
tests: Add some new tests and fix test 15
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/0015-keys-without-values.installfile | 10 | ||||
-rw-r--r-- | tests/fixtures/0022-all-kinds-of-atoms.installfile | 5 | ||||
-rw-r--r-- | tests/fixtures/0023-pkginstall-invalid-modifier.installfile | 5 | ||||
-rw-r--r-- | tests/spec/validator.rb | 17 |
4 files changed, 31 insertions, 6 deletions
diff --git a/tests/fixtures/0015-keys-without-values.installfile b/tests/fixtures/0015-keys-without-values.installfile index 7cb7aff..758a510 100644 --- a/tests/fixtures/0015-keys-without-values.installfile +++ b/tests/fixtures/0015-keys-without-values.installfile @@ -1,5 +1,7 @@ -network -hostname -pkginstall +network true +hostname test.machine +pkginstall adelie-base rootpw -mount +mount /dev/sda1 / +username +useralias diff --git a/tests/fixtures/0022-all-kinds-of-atoms.installfile b/tests/fixtures/0022-all-kinds-of-atoms.installfile new file mode 100644 index 0000000..65e53b7 --- /dev/null +++ b/tests/fixtures/0022-all-kinds-of-atoms.installfile @@ -0,0 +1,5 @@ +network true +hostname test.machine +pkginstall adelie-base musl>1.1.23-r5 konsole=19.12.0-r0 libxxf86vm>=1.1.4-r2 openssh-server<7.9_p1-r4 help2man-doc=1.47.10-r0 perl-encode-jisx0213>0.04-r0 font-adobe-100dpi polkit-qt-1=0.113.0-r0 libssl1.0=1.0.2t-r0 +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / diff --git a/tests/fixtures/0023-pkginstall-invalid-modifier.installfile b/tests/fixtures/0023-pkginstall-invalid-modifier.installfile new file mode 100644 index 0000000..8b8b3de --- /dev/null +++ b/tests/fixtures/0023-pkginstall-invalid-modifier.installfile @@ -0,0 +1,5 @@ +network true +hostname test.machine +pkginstall adelie-base=>1 musl=<2 +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb index 4efe03c..1c3657e 100644 --- a/tests/spec/validator.rb +++ b/tests/spec/validator.rb @@ -24,12 +24,13 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do end end context "on invalid keys" do - before(:each) { use_fixture '0016-invalid-key.installfile' } it "warns on invalid keys by default" do + use_fixture '0016-invalid-key.installfile' run_validate expect(last_command_started).to have_output(/warning: .*chat.* not defined/) end it "errors on invalid keys in strict mode" do + use_fixture '0016-invalid-key.installfile' run_validate ' --strict' expect(last_command_started).to have_output(/error: .*chat.* not defined/) end @@ -53,7 +54,7 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do it "requires keys to have values" do use_fixture '0015-keys-without-values.installfile' run_validate ' --keep-going' - expect(last_command_started).to have_output(/5 error\(s\)/) + expect(last_command_started).to have_output(/2 error\(s\)/) end it "fails on lines over maximum line length" do use_fixture '0017-line-too-long.installfile' @@ -126,5 +127,17 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do expect(last_command_started).to have_output(/error: .*duplicate.*rootpw/) end end + context "package specifications" do + it "works with all types of package atoms" do + use_fixture '0022-all-kinds-of-atoms.installfile' + run_validate + expect(last_command_started).to have_output(SUCCESS_OUTPUT) + end + it "does not accept invalid package atoms" do + use_fixture '0023-pkginstall-invalid-modifier.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*expected package.*/) + end + end end end |