Skip to content

(PUP-10929) remove unused orchestrator application keywords #8530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/puppet/pops/parser/lexer2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ class Lexer2
'type' => [:TYPE, 'type', 4],
'attr' => [:ATTR, 'attr', 4],
'private' => [:PRIVATE, 'private', 7],
'application' => [:APPLICATION, 'application', 11], # reserved
'consumes' => [:CONSUMES, 'consumes', 8], # reserved
'produces' => [:PRODUCES, 'produces', 8], # reserved
'site' => [:SITE, 'site', 4], # reserved
}

KEYWORDS.each {|k,v| v[1].freeze; v.freeze }
Expand Down
4 changes: 0 additions & 4 deletions spec/unit/pops/parser/lexer2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ def epp_tokens_scanned_from(s)
"private" => :PRIVATE,
"type" => :TYPE,
"attr" => :ATTR,
"application" => :APPLICATION,
"consumes" => :CONSUMES,
"produces" => :PRODUCES,
"site" => :SITE,
}.each do |string, name|
it "should lex a keyword from '#{string}'" do
expect(tokens_scanned_from(string)).to match_tokens2(name)
Expand Down
13 changes: 0 additions & 13 deletions spec/unit/pops/parser/parse_application_spec.rb

This file was deleted.

23 changes: 0 additions & 23 deletions spec/unit/pops/parser/parse_capabilities_spec.rb

This file was deleted.

43 changes: 0 additions & 43 deletions spec/unit/pops/parser/parse_site_spec.rb

This file was deleted.

63 changes: 20 additions & 43 deletions spec/unit/pops/validator/validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,6 @@ def with_environment(environment, env_params = {})
end
end

it 'produces a syntax error for application' do
expect {
parse('application test {}')
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application'/)
end

it 'produces a syntax error for capability mapping' do
expect {
parse('Foo produces Sql {}')
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/)
end

it 'produces an error for collect expressions with virtual query' do
acceptor = validate(parse("User <| title == 'admin' |>"))
expect(acceptor.error_count).to eql(1)
Expand Down Expand Up @@ -410,12 +398,6 @@ def with_environment(environment, env_params = {})
expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING)
end

it 'produces a syntax error for site definitions' do
expect {
parse('site {}')
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site'/)
end

context 'validating apply() blocks' do
it 'allows empty apply() blocks' do
acceptor = validate(parse('apply("foo.example.com") { }'))
Expand Down Expand Up @@ -468,18 +450,6 @@ def with_environment(environment, env_params = {})
expect(acceptor.error_count).to eql(0)
end

it 'produces a syntax error for application' do
expect {
parse('apply("foo.example.com") { application test {} }')
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application'/)
end

it 'produces a syntax error for capability mapping' do
expect {
parse('apply("foo.example.com") { Foo produces Sql {} }')
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/)
end

it 'produces an error for class expressions' do
acceptor = validate(parse('apply("foo.example.com") { class test {} }'))
expect(acceptor.error_count).to eql(1)
Expand All @@ -503,12 +473,6 @@ def with_environment(environment, env_params = {})
expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING)
end

it 'produces an error for site definitions' do
expect {
parse('apply("foo.example.com") { site {} }')
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site'/)
end

it 'produces an error for apply() inside apply()' do
acceptor = validate(parse('apply("foo.example.com") { apply("foo.example.com") { } }'))
expect(acceptor.error_count).to eql(1)
Expand Down Expand Up @@ -1010,14 +974,27 @@ class foo {}
expect(acceptor.errors[2].source_pos.line).to eql(5)
end
end
end
[
"application",
"consumes",
"produces",
"site",
].each do |kw|
it "allow usage of #{kw} keyword (it was reserved in puppet 6.x)" do
source = <<-SOURCE
class foo (
$#{kw},
) {
notice $#{kw}
}

class { foo:
#{kw} => 'bar'
}
SOURCE

context "capability annotations" do
['produces', 'consumes'].each do |word|
it "raises a syntax error in #{word} clauses" do
expect {
parse("foo #{word} Bar {}")
}.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{word}'/)
acceptor = validate(parse(source, 'path/foo/manifests/init.pp'))
expect(acceptor.error_count).to eql(0)
end
end
end
Expand Down