Skip to content

Commit 1ddeb5c

Browse files
committed
Remove puppet applications support
1 parent f4c5c71 commit 1ddeb5c

File tree

9 files changed

+6
-172
lines changed

9 files changed

+6
-172
lines changed

README.md

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* [Configuration](#configuration)
99
* [Naming conventions](#naming-conventions)
1010
* [Example groups](#example-groups)
11-
* [Defined Types, Classes & Applications](#defined-types-classes--applications)
11+
* [Defined Types and Classes](#defined-types-and-classes)
1212
* [Functions](#functions)
1313
* [Hiera integration](#hiera-integration)
1414
* [Producing coverage reports](#producing-coverage-reports)
@@ -259,9 +259,6 @@ structure and naming convention.
259259
├── defines/
260260
│ └── <define_name>_spec.rb
261261
262-
├── applications/
263-
│ └── <application_name>_spec.rb
264-
265262
├── functions/
266263
│ └── <function_name>_spec.rb
267264
@@ -289,10 +286,6 @@ describe 'mydefine', :type => :define do
289286
...
290287
end
291288

292-
describe 'myapplication', :type => :application do
293-
...
294-
end
295-
296289
describe 'myfunction', :type => :puppet_function do
297290
...
298291
end
@@ -310,7 +303,7 @@ describe 'myhost.example.com', :type => :host do
310303
end
311304
```
312305

313-
## Defined Types, Classes & Applications
306+
## Defined Types and Classes
314307

315308
### Matchers
316309

@@ -601,7 +594,7 @@ let(:title) { 'foo' }
601594

602595
#### Specifying the parameters to pass to a resources or parameterised class
603596

604-
Parameters of a defined type, class or application can be passed defining `:params` in a let,
597+
Parameters of a defined type or class can be passed defining `:params` in a let,
605598
and passing it a hash as seen below.
606599

607600
```ruby
@@ -621,7 +614,7 @@ let(:params) { {'password' =>sensitive('secret') } }
621614
```
622615

623616
For references to nodes or resources as seen when using `require` or `before` properties,
624-
or an `application` resource you can pass the string as an argument to the `ref` helper:
617+
you can pass the string as an argument to the `ref` helper:
625618

626619
```ruby
627620
let(:params) { 'require' => ref('Package', 'sudoku') }
@@ -633,18 +626,6 @@ Which translates to:
633626
mydefine { 'mytitle': require => Package['sudoku'] }
634627
```
635628

636-
Another example, for an application setup (when using `app_management`):
637-
638-
```ruby
639-
let(:params) { { 'nodes' => { ref('Node', 'dbnode') => ref('Myapp::Mycomponent', 'myapp') } } }
640-
```
641-
642-
Will translate to:
643-
644-
```puppet
645-
site { myapp { 'myimpl': nodes => { Node['dbnode'] => Myapp::Mycomponent['myimpl'] } } }
646-
```
647-
648629
#### Specifying the FQDN of the test node
649630

650631
If the manifest you're testing expects to run on host with a particular name,
@@ -835,46 +816,6 @@ You can also use `exported_resources` directly in a test:
835816
it { expect(exported_resources).to contain_file('foo') }
836817
```
837818

838-
#### Testing applications
839-
840-
Applications in some ways behave as defined resources, but are more complex so
841-
require a number of elements already documented above to be combined for testing.
842-
843-
A full example of the simplest rspec test for a single component application:
844-
845-
```ruby
846-
require 'spec_helper'
847-
848-
describe 'orch_app' do
849-
let(:node) { 'my_node' }
850-
let(:title) { 'my_awesome_app' }
851-
let(:params) do
852-
{
853-
'nodes' => {
854-
ref('Node', node) => ref('Orch_app::Db', title),
855-
}
856-
}
857-
end
858-
859-
it { should compile }
860-
it { should contain_orch_app(title) }
861-
end
862-
```
863-
864-
Each piece is required:
865-
866-
* You must turn on app_management during testing for the handling to work
867-
* The `:node` definition is required to be set so later on you can reference it in the `:nodes` argument within `:params`
868-
* Applications act like defined resources, and each require a `:title` to be defined
869-
* The `:nodes` key in `:params` requires the use of node reference mappings to resource
870-
mappings. The `ref` keyword allows you to provide these (a normal string will not work).
871-
872-
Beyond these requirements, the very basic `should compile` test and other matchers
873-
as you would expect will work the same as classes and defined resources.
874-
875-
**Note:** for the moment, cross-node support is not available and will return an error.
876-
Ensure you model your tests to be single-node for the time being.
877-
878819
## Functions
879820

880821
### Matchers

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace :test do
3232
if t.respond_to?(:exclude_pattern)
3333
t.exclude_pattern = 'spec/fixtures/**/*_spec.rb'
3434
else
35-
t.pattern = 'spec/{applications,classes,defines,functions,hosts,type_aliases,types,unit}/**/*_spec.rb'
35+
t.pattern = 'spec/{classes,defines,functions,hosts,type_aliases,types,unit}/**/*_spec.rb'
3636
end
3737
end
3838

docs/documentation/applications/index.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/documentation/index.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ cards:
3939
path: /documentation/hosts/
4040
icon: fa fa-server
4141
colour: orange
42-
-
43-
title: Testing Applications
44-
text:
45-
path: /documentation/applications/
46-
icon: fa fa-cubes
47-
colour: green
4842
-
4943
title: Testing Types
5044
text:

lib/rspec-puppet/example.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
require 'rspec-puppet/example/type_example_group'
99
require 'rspec-puppet/example/type_alias_example_group'
1010
require 'rspec-puppet/example/provider_example_group'
11-
require 'rspec-puppet/example/application_example_group'
1211

1312
RSpec.configure do |c|
1413
def c.rspec_puppet_include(group, type, file_path)
@@ -25,7 +24,6 @@ def c.rspec_puppet_include(group, type, file_path)
2524
c.rspec_puppet_include RSpec::Puppet::TypeExampleGroup, :type, %w[spec types]
2625
c.rspec_puppet_include RSpec::Puppet::TypeAliasExampleGroup, :type_alias, %w[spec type_aliases]
2726
c.rspec_puppet_include RSpec::Puppet::ProviderExampleGroup, :provider, %w[spec providers]
28-
c.rspec_puppet_include RSpec::Puppet::ApplicationExampleGroup, :application, %w[spec applications]
2927

3028
# Hook for each example group type to remove any caches or instance variables, since they will remain
3129
# and cause a memory leak. Can't be assigned per type by :file_path, so check for its presence.

lib/rspec-puppet/example/application_example_group.rb

Lines changed: 0 additions & 21 deletions
This file was deleted.

lib/rspec-puppet/support.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ def guess_type_from_path(path)
4444
:type_alias
4545
when %r{spec/provider}
4646
:provider
47-
when %r{spec/applications}
48-
:application
4947
else
5048
:unknown
5149
end
@@ -177,11 +175,6 @@ def test_manifest(type, opts = {})
177175
else
178176
"class { '#{class_name}': #{param_str(opts[:params])} }"
179177
end
180-
when :application
181-
raise ArgumentError, 'You need to provide params for an application' unless opts.key?(:params)
182-
183-
"site { #{class_name} { #{sanitise_resource_title(title)}: #{param_str(opts[:params])} } }"
184-
185178
when :define
186179
title_str = if title.is_a?(Array)
187180
'[' + title.map { |r| sanitise_resource_title(r) }.join(', ') + ']'
@@ -207,7 +200,7 @@ def sanitise_resource_title(title)
207200
def nodename(type)
208201
return node if respond_to?(:node)
209202

210-
if %i[class define function application].include? type
203+
if %i[class define function].include? type
211204
Puppet[:certname]
212205
else
213206
class_name

spec/fixtures/modules/orch_app/manifests/db.pp

Lines changed: 0 additions & 3 deletions
This file was deleted.

spec/fixtures/modules/orch_app/manifests/init.pp

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)