From 5b0d0916b27f271fc12a8c0c6b595e11673d306d Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 8 Oct 2019 19:55:53 -0500 Subject: hscript: Implement 'hostname' parsing; add rest of existing manual tests --- tests/spec/validator.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests') diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb index bd53853..e54d40e 100644 --- a/tests/spec/validator.rb +++ b/tests/spec/validator.rb @@ -50,6 +50,16 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do run_validate expect(last_command_started).to have_output(SUCCESS_OUTPUT) end + 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)/) + end + it "fails on lines over maximum line length" do + use_fixture '0017-line-too-long.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*length/) + end context "required keys" do it "fails without a 'network' key" do use_fixture '0006-no-network.installfile' @@ -77,6 +87,28 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do expect(last_command_started).to have_output(/error: .*mount.*/) end end + context "values" do + it "fails with an invalid 'network' value" do + use_fixture '0011-invalid-network.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*network.*/) + end + it "fails with an invalid 'hostname' value" do + use_fixture '0012-invalid-hostname.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*hostname.*/) + end + it "fails with an invalid 'rootpw' value" do + use_fixture '0013-invalid-rootpw.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*rootpw.*/) + end + it "fails with an invalid 'mount' value" do + use_fixture '0014-invalid-mount.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*mount.*/) + end + end context "unique keys" do it "fails with a duplicate 'network' key" do use_fixture '0018-duplicate-network.installfile' -- cgit v1.2.3-70-g09d2