diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 19:31:28 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 19:31:28 -0500 |
commit | 57307442c5d707591dfc4d5e7671364fa564fa5c (patch) | |
tree | 22fc576b23be7985be7be12d612b194069b0239b | |
parent | 6d110a03892bf164826b27bd9f92ef396f36d1b3 (diff) | |
download | horizon-57307442c5d707591dfc4d5e7671364fa564fa5c.tar.gz horizon-57307442c5d707591dfc4d5e7671364fa564fa5c.tar.bz2 horizon-57307442c5d707591dfc4d5e7671364fa564fa5c.tar.xz horizon-57307442c5d707591dfc4d5e7671364fa564fa5c.zip |
hscript: Better message for duplicate value, and test for it
-rw-r--r-- | hscript/script.cc | 2 | ||||
-rw-r--r-- | tests/spec/validator.rb | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/hscript/script.cc b/hscript/script.cc index a07af15..a8101dc 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -93,7 +93,7 @@ struct Script::ScriptPrivate { err_str += std::to_string(this->network->lineno()); if(errors) *errors += 1; output_error("installfile:" + std::to_string(lineno), - "'network' key has already been specified", + "duplicate value for key 'network'", err_str); return false; } diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb index 69fe0d1..bd53853 100644 --- a/tests/spec/validator.rb +++ b/tests/spec/validator.rb @@ -77,5 +77,22 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do 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' + run_validate + expect(last_command_started).to have_output(/error: .*duplicate.*network/) + end + it "fails with a duplicate 'hostname' key" do + use_fixture '0019-duplicate-hostname.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*duplicate.*hostname/) + end + it "fails with a duplicate 'rootpw' key" do + use_fixture '0020-duplicate-rootpw.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*duplicate.*rootpw/) + end + end end end |