puppet_litmus 0.18.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/exe/matrix_from_metadata +62 -0
- data/lib/puppet_litmus.rb +0 -1
- data/lib/puppet_litmus/inventory_manipulation.rb +16 -8
- data/lib/puppet_litmus/puppet_helpers.rb +51 -15
- data/lib/puppet_litmus/rake_helper.rb +94 -58
- data/lib/puppet_litmus/rake_tasks.rb +120 -94
- data/lib/puppet_litmus/spec_helper_acceptance.rb +4 -1
- data/lib/puppet_litmus/version.rb +1 -1
- data/spec/lib/puppet_litmus/inventory_manipulation_spec.rb +16 -16
- data/spec/lib/puppet_litmus/puppet_helpers_spec.rb +135 -106
- data/spec/lib/puppet_litmus/rake_helper_spec.rb +23 -23
- data/spec/lib/puppet_litmus/rake_tasks_spec.rb +11 -10
- data/spec/spec_helper.rb +7 -6
- metadata +28 -22
- data/lib/puppet_litmus/honeycomb_utils.rb +0 -13
@@ -19,17 +19,17 @@ describe 'litmus rake tasks' do
|
|
19
19
|
'template-ref' => 'heads/master-0-g7827fc2' }
|
20
20
|
expect(File).to receive(:read).with(any_args).once
|
21
21
|
expect(JSON).to receive(:parse).with(any_args).and_return(metadata)
|
22
|
-
expect(
|
23
|
-
expect(
|
24
|
-
expect(
|
22
|
+
expect($stdout).to receive(:puts).with('redhat-5-x86_64')
|
23
|
+
expect($stdout).to receive(:puts).with('ubuntu-1404-x86_64')
|
24
|
+
expect($stdout).to receive(:puts).with('ubuntu-1804-x86_64')
|
25
25
|
Rake::Task['litmus:metadata'].invoke
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'with litmus:install_modules_from_directory' do
|
30
30
|
let(:inventory_hash) { { 'groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'uri' => 'some.host' }] }] } }
|
31
|
-
let(:
|
32
|
-
let(:dummy_tar) {
|
31
|
+
let(:target_dir) { File.join(Dir.pwd, 'spec/fixtures/modules') }
|
32
|
+
let(:dummy_tar) { 'spec/data/doot.tar.gz' }
|
33
33
|
|
34
34
|
it 'happy path' do
|
35
35
|
allow(File).to receive(:exist?).with(File.join(Dir.pwd, 'metadata.json')).and_return(true)
|
@@ -37,12 +37,13 @@ describe 'litmus rake tasks' do
|
|
37
37
|
|
38
38
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
39
39
|
expect_any_instance_of(PuppetLitmus::InventoryManipulation).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
40
|
-
expect(File).to receive(:directory?).with(
|
41
|
-
expect_any_instance_of(Object).to receive(:
|
42
|
-
expect(
|
40
|
+
expect(File).to receive(:directory?).with(target_dir).and_return(true)
|
41
|
+
expect_any_instance_of(Object).to receive(:build_modules_in_dir).with(target_dir).and_return([dummy_tar])
|
42
|
+
expect($stdout).to receive(:puts).with(start_with('Building all modules in'))
|
43
43
|
expect_any_instance_of(Object).to receive(:upload_file).once.and_return([])
|
44
|
-
expect(
|
44
|
+
expect($stdout).to receive(:puts).with(start_with('Installing \'spec/data/doot.tar.gz\''))
|
45
45
|
expect_any_instance_of(Object).to receive(:run_command).twice.and_return([])
|
46
|
+
expect($stdout).to receive(:puts).with(start_with('Installed \'spec/data/doot.tar.gz\''))
|
46
47
|
Rake::Task['litmus:install_modules_from_directory'].invoke('./spec/fixtures/modules')
|
47
48
|
end
|
48
49
|
end
|
@@ -67,7 +68,7 @@ describe 'litmus rake tasks' do
|
|
67
68
|
|
68
69
|
allow(File).to receive(:directory?).with(any_args).and_return(true)
|
69
70
|
allow_any_instance_of(BoltSpec::Run).to receive(:run_task).with(any_args).and_return(results)
|
70
|
-
expect(
|
71
|
+
expect($stdout).to receive(:puts).with('localhost:2222, centos:7')
|
71
72
|
Rake::Task['litmus:provision'].invoke('docker', 'centos:7')
|
72
73
|
end
|
73
74
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rspec'
|
4
|
-
require 'puppet_litmus'
|
5
|
-
|
6
|
-
# Unfortunately this needs to be included as this is
|
7
|
-
# how Litmus functions. We only include once here instead
|
8
|
-
# of including for every single spec file.
|
9
|
-
include PuppetLitmus # rubocop:disable Style/MixinUsage
|
10
4
|
|
11
5
|
if ENV['COVERAGE'] == 'yes'
|
12
6
|
require 'simplecov'
|
@@ -37,3 +31,10 @@ if ENV['COVERAGE'] == 'yes'
|
|
37
31
|
end
|
38
32
|
end
|
39
33
|
end
|
34
|
+
|
35
|
+
# This is basically how `configure!` sets up RSpec in tests.
|
36
|
+
require 'puppet_litmus'
|
37
|
+
RSpec.configure do |config|
|
38
|
+
config.include PuppetLitmus
|
39
|
+
config.extend PuppetLitmus
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_litmus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bolt
|
@@ -34,16 +34,22 @@ dependencies:
|
|
34
34
|
name: puppet-modulebuilder
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.2.1
|
40
|
+
- - "<"
|
38
41
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
42
|
+
version: 1.0.0
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - "
|
47
|
+
- - ">="
|
45
48
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
49
|
+
version: 0.2.1
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.0.0
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: tty-spinner
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +79,7 @@ dependencies:
|
|
73
79
|
version: '1.34'
|
74
80
|
- - "<"
|
75
81
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
82
|
+
version: 3.0.0
|
77
83
|
type: :runtime
|
78
84
|
prerelease: false
|
79
85
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,7 +89,7 @@ dependencies:
|
|
83
89
|
version: '1.34'
|
84
90
|
- - "<"
|
85
91
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
92
|
+
version: 3.0.0
|
87
93
|
- !ruby/object:Gem::Dependency
|
88
94
|
name: parallel
|
89
95
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,14 +150,15 @@ description: " Providing a simple command line tool for puppet content creato
|
|
144
150
|
to enable simple and complex test deployments.\n"
|
145
151
|
email:
|
146
152
|
- info@puppet.com
|
147
|
-
executables:
|
153
|
+
executables:
|
154
|
+
- matrix_from_metadata
|
148
155
|
extensions: []
|
149
156
|
extra_rdoc_files: []
|
150
157
|
files:
|
151
158
|
- LICENSE
|
152
159
|
- README.md
|
160
|
+
- exe/matrix_from_metadata
|
153
161
|
- lib/puppet_litmus.rb
|
154
|
-
- lib/puppet_litmus/honeycomb_utils.rb
|
155
162
|
- lib/puppet_litmus/inventory_manipulation.rb
|
156
163
|
- lib/puppet_litmus/puppet_helpers.rb
|
157
164
|
- lib/puppet_litmus/rake_helper.rb
|
@@ -173,7 +180,7 @@ homepage: https://github.com/puppetlabs/puppet_litmus
|
|
173
180
|
licenses:
|
174
181
|
- Apache-2.0
|
175
182
|
metadata: {}
|
176
|
-
post_install_message:
|
183
|
+
post_install_message:
|
177
184
|
rdoc_options: []
|
178
185
|
require_paths:
|
179
186
|
- lib
|
@@ -188,20 +195,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
195
|
- !ruby/object:Gem::Version
|
189
196
|
version: '0'
|
190
197
|
requirements: []
|
191
|
-
|
192
|
-
|
193
|
-
signing_key:
|
198
|
+
rubygems_version: 3.1.4
|
199
|
+
signing_key:
|
194
200
|
specification_version: 4
|
195
201
|
summary: Providing a simple command line tool for puppet content creators, to enable
|
196
202
|
simple and complex test deployments.
|
197
203
|
test_files:
|
198
|
-
- spec/
|
199
|
-
- spec/
|
200
|
-
- spec/data/jim.yaml
|
201
|
-
- spec/lib/puppet_litmus/util_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
205
|
+
- spec/lib/puppet_litmus/rake_tasks_spec.rb
|
202
206
|
- spec/lib/puppet_litmus/version_spec.rb
|
207
|
+
- spec/lib/puppet_litmus/util_spec.rb
|
203
208
|
- spec/lib/puppet_litmus/inventory_manipulation_spec.rb
|
204
209
|
- spec/lib/puppet_litmus/rake_helper_spec.rb
|
205
210
|
- spec/lib/puppet_litmus/puppet_helpers_spec.rb
|
206
|
-
- spec/
|
207
|
-
- spec/
|
211
|
+
- spec/data/doot.tar.gz
|
212
|
+
- spec/data/jim.yaml
|
213
|
+
- spec/data/inventory.yaml
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module PuppetLitmus; end # rubocop:disable Style/Documentation
|
4
|
-
|
5
|
-
# a set of semi-private utility functions that should not contaminate the global namespace
|
6
|
-
module PuppetLitmus::HoneycombUtils
|
7
|
-
module_function
|
8
|
-
|
9
|
-
def add_platform_field(inventory_hash, target_node_name)
|
10
|
-
facts = facts_from_node(inventory_hash, target_node_name)
|
11
|
-
Honeycomb.current_span.add_field('litmus.platform', facts&.dig('platform'))
|
12
|
-
end
|
13
|
-
end
|