Skip to content

Commit

Permalink
(PUP-4242) change deprecation warning for file namespace mismatch to …
Browse files Browse the repository at this point in the history
…an error
  • Loading branch information
kris-bosland committed Sep 7, 2018
1 parent ddf8b76 commit 81e61de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
1 change: 0 additions & 1 deletion lib/puppet/pops/validation/validator_factory_4_0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def severity_producer
p[Issues::NAME_WITH_HYPHEN] = :error
p[Issues::EMPTY_RESOURCE_SPECIALIZATION] = :ignore
p[Issues::CLASS_NOT_VIRTUALIZABLE] = Puppet[:strict] == :off ? :warning : Puppet[:strict]
p[Issues::ILLEGAL_DEFINITION_LOCATION] = :deprecation
p
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function puppet_init_calling_puppet() {
function user::puppet_init_calling_puppet() {
usee::usee_puppet()
}

function puppet_init_calling_puppet_init() {
function user::puppet_init_calling_puppet_init() {
usee_puppet_init()
}

function puppet_init_calling_ruby() {
function user::puppet_init_calling_ruby() {
usee::usee_ruby()
}

Expand Down Expand Up @@ -53,18 +53,18 @@ function puppet_init_calling_ruby() {
7: {
# Call a puppet function that resides in usee/functions from a puppet function in init.pp
#
notify { 'case_7': message => puppet_init_calling_puppet() }
notify { 'case_7': message => user::puppet_init_calling_puppet() }
}
8: {
# Call a puppet function that resides in usee/manifests/init.pp from a puppet function in init.pp
#
include usee
notify { 'case_8': message => puppet_init_calling_puppet_init() }
notify { 'case_8': message => user::puppet_init_calling_puppet_init() }
}
9: {
# Call a ruby function that resides in usee from a puppet function in init.pp
#
notify { 'case_9': message => puppet_init_calling_ruby() }
notify { 'case_9': message => user::puppet_init_calling_ruby() }
}
10: {
# Call a puppet function that resides in usee/functions from a ruby function in this module
Expand Down
32 changes: 16 additions & 16 deletions spec/unit/pops/validator/validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ def with_environment(environment, env_params = {})
expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
end

it 'produces a deprecation for illegal function locations' do
it 'produces an error for illegal function locations' do
with_environment(environment) do
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
expect(deprecation_count(acceptor)).to eql(1)
expect(acceptor.warning_count).to eql(1)
expect(acceptor.error_count).to eql(0)
expect(deprecation_count(acceptor)).to eql(0)
expect(acceptor.warning_count).to eql(0)
expect(acceptor.error_count).to eql(1)
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
end
end
Expand Down Expand Up @@ -170,12 +170,12 @@ def with_environment(environment, env_params = {})
expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE)
end

it 'produces a deprecation for illegal function locations' do
it 'produces an error for illegal function locations' do
with_environment(environment) do
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
expect(deprecation_count(acceptor)).to eql(1)
expect(acceptor.warning_count).to eql(1)
expect(acceptor.error_count).to eql(0)
expect(deprecation_count(acceptor)).to eql(0)
expect(acceptor.warning_count).to eql(0)
expect(acceptor.error_count).to eql(1)
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
end
end
Expand Down Expand Up @@ -211,12 +211,12 @@ def with_environment(environment, env_params = {})
expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE)
end

it 'produces a deprecation for illegal function locations' do
it 'produces an error for illegal function locations' do
with_environment(environment) do
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
expect(deprecation_count(acceptor)).to eql(1)
expect(acceptor.warning_count).to eql(1)
expect(acceptor.error_count).to eql(0)
expect(deprecation_count(acceptor)).to eql(0)
expect(acceptor.warning_count).to eql(0)
expect(acceptor.error_count).to eql(1)
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
end
end
Expand All @@ -231,12 +231,12 @@ def with_environment(environment, env_params = {})
expect(acceptor).to_not have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
end

it 'produces a deprecation for illegal function locations' do
it 'produces an error for illegal function locations' do
with_environment(environment) do
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
expect(deprecation_count(acceptor)).to eql(1)
expect(acceptor.warning_count).to eql(1)
expect(acceptor.error_count).to eql(0)
expect(deprecation_count(acceptor)).to eql(0)
expect(acceptor.warning_count).to eql(0)
expect(acceptor.error_count).to eql(1)
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
end
end
Expand Down

0 comments on commit 81e61de

Please sign in to comment.