pdqtest 1.4.1 → 1.9.9beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +9 -3
- data/doc/acceptance_tests.md +100 -22
- data/doc/caching.md +5 -1
- data/doc/development.md +16 -5
- data/doc/emoji.md +20 -9
- data/doc/enabling_testing.md +15 -3
- data/doc/examples.md +25 -6
- data/doc/hiera.md +30 -11
- data/doc/installation.md +59 -8
- data/doc/pdk.md +334 -0
- data/doc/puppet_facts.md +45 -3
- data/doc/puppet_module_dependencies.md +34 -16
- data/doc/running_tests.md +35 -15
- data/doc/test_generation.md +11 -19
- data/doc/tips_and_tricks.md +17 -8
- data/doc/troubleshooting.md +19 -8
- data/doc/upgrading.md +125 -6
- data/doc/windows.md +51 -0
- data/docker_images/centos/Dockerfile +4 -3
- data/docker_images/centos/Makefile +1 -1
- data/docker_images/ubuntu/Dockerfile +3 -3
- data/docker_images/windows/Dockerfile +26 -0
- data/docker_images/windows/make.ps1 +2 -0
- data/exe/pdqtest +73 -28
- data/lib/pdqtest/core.rb +1 -1
- data/lib/pdqtest/docker.rb +143 -51
- data/lib/pdqtest/emoji.rb +33 -7
- data/lib/pdqtest/fastcheck.rb +19 -0
- data/lib/pdqtest/instance.rb +16 -15
- data/lib/pdqtest/logger.rb +35 -0
- data/lib/pdqtest/pdk.rb +98 -0
- data/lib/pdqtest/pdqtest1x.rb +115 -0
- data/lib/pdqtest/puppet.rb +277 -134
- data/lib/pdqtest/skeleton.rb +119 -39
- data/lib/pdqtest/upgrade.rb +42 -42
- data/lib/pdqtest/util.rb +82 -2
- data/lib/pdqtest/version.rb +1 -2
- data/pdqtest.gemspec +8 -13
- data/res/{skeleton → acceptance}/init.bats +0 -0
- data/res/{skeleton → acceptance}/init__before.bats +0 -0
- data/res/{skeleton → acceptance}/init__setup.sh +0 -0
- data/res/skeleton/.puppet-lint.rc +5 -0
- data/res/skeleton/{dot_travis.yml → .travis.yml} +0 -0
- data/res/skeleton/Makefile +20 -5
- data/res/skeleton/make.ps1 +66 -0
- data/res/skeleton/spec/fixtures/hiera.yaml +13 -0
- data/res/skeleton/spec/fixtures/hieradata/test.yaml +11 -0
- data/res/templates/examples_init.pp.erb +1 -1
- metadata +47 -115
- data/lib/pdqtest/lint.rb +0 -31
- data/lib/pdqtest/rspec.rb +0 -69
- data/lib/pdqtest/syntax.rb +0 -20
- data/res/skeleton/Gemfile +0 -7
- data/res/skeleton/Rakefile +0 -3
- data/res/skeleton/dot_gitignore +0 -9
- data/res/skeleton/dot_rspec +0 -2
- data/res/skeleton/hiera.yaml +0 -7
- data/res/skeleton/spec_helper.rb +0 -4
- data/res/skeleton/test.yaml +0 -3
data/lib/pdqtest/skeleton.rb
CHANGED
@@ -4,19 +4,41 @@ require 'pdqtest/puppet'
|
|
4
4
|
require 'pdqtest/version'
|
5
5
|
require 'pdqtest/util'
|
6
6
|
require 'pdqtest/upgrade'
|
7
|
+
require 'pdqtest/pdqtest1x'
|
8
|
+
require 'pdqtest/pdk'
|
9
|
+
require 'erb'
|
7
10
|
|
8
11
|
module PDQTest
|
9
12
|
module Skeleton
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
HIERA_DIR
|
18
|
-
HIERA_YAML
|
19
|
-
HIERA_TEST
|
13
|
+
|
14
|
+
TEMP_PDK_MODULE = "x"
|
15
|
+
FIXTURES = '.fixtures.yml'
|
16
|
+
SPEC_DIR = 'spec'
|
17
|
+
ACCEPTANCE_DIR = File.join(SPEC_DIR, 'acceptance')
|
18
|
+
SKELETON_DIR = 'skeleton'
|
19
|
+
EXAMPLES_DIR = 'examples'
|
20
|
+
HIERA_DIR = File.join(SPEC_DIR, 'fixtures', 'hieradata')
|
21
|
+
HIERA_YAML = 'hiera.yaml'
|
22
|
+
HIERA_TEST = 'test.yaml'
|
23
|
+
PDK_FILES = [
|
24
|
+
"spec/spec_helper.rb",
|
25
|
+
"spec/default_facts.yml",
|
26
|
+
".pdkignore",
|
27
|
+
"Gemfile",
|
28
|
+
"Rakefile",
|
29
|
+
".gitignore",
|
30
|
+
]
|
31
|
+
|
32
|
+
# PDK adds custom metadata fields which we can ONLY get by creating a new
|
33
|
+
# module. We already do this so stash the details here when we have them
|
34
|
+
@@pdk_metadata = {}
|
35
|
+
|
36
|
+
# Every time we `pdqtest upgrade`, update .sync.yml (merges)
|
37
|
+
SYNC_YML_CONTENT = {
|
38
|
+
".travis.yml" => {
|
39
|
+
"unmanaged": true
|
40
|
+
}
|
41
|
+
}
|
20
42
|
|
21
43
|
|
22
44
|
def self.should_replace_file(target, skeleton)
|
@@ -26,11 +48,16 @@ module PDQTest
|
|
26
48
|
target_hash != skeleton_hash
|
27
49
|
end
|
28
50
|
|
51
|
+
def self.install_skeletons
|
52
|
+
FileUtils.cp_r(Util.resource_path(File.join(SKELETON_DIR) + "/."), ".")
|
53
|
+
end
|
54
|
+
|
55
|
+
|
29
56
|
def self.install_skeleton(target_file, skeleton, replace=true)
|
30
|
-
skeleton_file = Util
|
57
|
+
skeleton_file = Util.resource_path(File.join(SKELETON_DIR, skeleton))
|
31
58
|
install = false
|
32
59
|
if File.exists?(target_file)
|
33
|
-
if replace
|
60
|
+
if replace && should_replace_file(target_file, skeleton_file)
|
34
61
|
install = true
|
35
62
|
end
|
36
63
|
else
|
@@ -51,55 +78,51 @@ module PDQTest
|
|
51
78
|
end
|
52
79
|
end
|
53
80
|
|
54
|
-
def self.
|
81
|
+
def self.install_gemfile_project
|
55
82
|
install_skeleton(GEMFILE, GEMFILE)
|
56
83
|
|
57
84
|
# upgrade the gemfile to *this* version of pdqtest + puppet-strings
|
58
85
|
Upgrade.upgrade()
|
59
86
|
end
|
60
87
|
|
61
|
-
def self.
|
62
|
-
|
63
|
-
# move .fixtures.yml out of the way
|
64
|
-
if File.exists?(FIXTURES)
|
65
|
-
File.delete(FIXTURES)
|
66
|
-
end
|
67
|
-
|
68
|
-
# make directory structure for testcases
|
88
|
+
def self.directory_structure
|
69
89
|
FileUtils.mkdir_p(ACCEPTANCE_DIR)
|
70
|
-
FileUtils.mkdir_p(CLASSES_DIR)
|
71
90
|
FileUtils.mkdir_p(EXAMPLES_DIR)
|
72
91
|
FileUtils.mkdir_p(HIERA_DIR)
|
92
|
+
end
|
73
93
|
|
94
|
+
def self.init
|
95
|
+
directory_structure
|
74
96
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
install_skeleton('.rspec', 'dot_rspec')
|
80
|
-
install_skeleton(File.join(SPEC_DIR, 'fixtures', HIERA_YAML), HIERA_YAML)
|
81
|
-
install_skeleton(File.join(HIERA_DIR, HIERA_TEST), HIERA_TEST)
|
82
|
-
|
83
|
-
install_acceptance()
|
84
|
-
install_gemfile()
|
85
|
-
install_integrations()
|
97
|
+
install_pdk_skeletons
|
98
|
+
install_skeletons
|
99
|
+
install_acceptance
|
100
|
+
Upgrade.upgrade()
|
86
101
|
|
87
|
-
#
|
102
|
+
# the very _last_ thing we do is enable PDK in metadata. Once this switch
|
103
|
+
# is set, we never touch the files in PDK_FILES again
|
104
|
+
PDQTest::Pdk.enable_pdk(@@pdk_metadata)
|
88
105
|
end
|
89
106
|
|
90
|
-
|
107
|
+
# on upgrade, do a more limited skeleton copy - just our own integration
|
108
|
+
# points
|
109
|
+
def self.upgrade
|
91
110
|
install_skeleton('Makefile', 'Makefile')
|
111
|
+
install_skeleton('make.ps1', 'make.ps1')
|
92
112
|
install_skeleton('bitbucket-pipelines.yml', 'bitbucket-pipelines.yml')
|
93
|
-
install_skeleton('.travis.yml', '
|
113
|
+
install_skeleton('.travis.yml', '.travis.yml')
|
114
|
+
Pdk.amend_sync_yml(SYNC_YML_CONTENT)
|
94
115
|
end
|
95
116
|
|
96
117
|
def self.install_acceptance(example_file ="init.pp")
|
118
|
+
directory_structure
|
119
|
+
|
97
120
|
example_name = File.basename(example_file).gsub(/\.pp$/, '')
|
98
121
|
install_template("#{EXAMPLES_DIR}/#{File.basename(example_file)}",'examples_init.pp.erb', {})
|
99
122
|
|
100
|
-
install_skeleton(File.join('spec', 'acceptance', "#{example_name}.bats"), 'init.bats', false)
|
101
|
-
install_skeleton(File.join('spec', 'acceptance', "#{example_name}__before.bats"), 'init__before.bats', false)
|
102
|
-
install_skeleton(File.join('spec', 'acceptance', "#{example_name}__setup.sh"), 'init__setup.sh', false)
|
123
|
+
install_skeleton(File.join('spec', 'acceptance', "#{example_name}.bats"), '../acceptance/init.bats', false)
|
124
|
+
install_skeleton(File.join('spec', 'acceptance', "#{example_name}__before.bats"), '../acceptance/init__before.bats', false)
|
125
|
+
install_skeleton(File.join('spec', 'acceptance', "#{example_name}__setup.sh"), '../acceptance/init__setup.sh', false)
|
103
126
|
end
|
104
127
|
|
105
128
|
# Scan the examples directory and create a set of acceptance tests. If a
|
@@ -122,5 +145,62 @@ module PDQTest
|
|
122
145
|
install_acceptance(e)
|
123
146
|
}
|
124
147
|
end
|
148
|
+
|
149
|
+
|
150
|
+
def self.install_pdk_skeletons
|
151
|
+
|
152
|
+
if ! PDQTest::Pdk.is_pdk_enabled
|
153
|
+
$logger.info "Doing one-time upgrade to PDK - Generating fresh set of files..."
|
154
|
+
project_dir = File.expand_path Dir.pwd
|
155
|
+
Dir.mktmpdir do |tmpdir|
|
156
|
+
Dir.chdir(tmpdir) do
|
157
|
+
status = PDQTest::Pdk.run("new module #{TEMP_PDK_MODULE} --skip-interview")
|
158
|
+
|
159
|
+
if status
|
160
|
+
# snag generated metadata now we are in the temporary module dir
|
161
|
+
Dir.chdir TEMP_PDK_MODULE do
|
162
|
+
@@pdk_metadata = PDQTest::Puppet.module_metadata
|
163
|
+
end
|
164
|
+
|
165
|
+
PDK_FILES.each do |pdk_file|
|
166
|
+
upstream_file = File.join(tmpdir, TEMP_PDK_MODULE, pdk_file)
|
167
|
+
|
168
|
+
# check if we are trying to install a file from PDQTest or have
|
169
|
+
# some random/customised file in place
|
170
|
+
Dir.chdir project_dir do
|
171
|
+
if PDQTest1x.was_pdqtest_file(pdk_file)
|
172
|
+
if ! File.exists?(pdk_file) || PDQTest1x.is_pdqtest_file(pdk_file)
|
173
|
+
# overwrite missing or PDQTest 1x files
|
174
|
+
install = true
|
175
|
+
else
|
176
|
+
raise(<<~END)
|
177
|
+
Detected an unknown/customised file at
|
178
|
+
#{pdk_file}
|
179
|
+
Please see the PDQTest 1x->2x upgrade guide at
|
180
|
+
https://github.com/declarativesystems/pdqtest/blob/master/doc/upgrading.md
|
181
|
+
|
182
|
+
If your sure you don't want this file any more, move it out
|
183
|
+
of the way and re-run the previous command
|
184
|
+
END
|
185
|
+
end
|
186
|
+
else
|
187
|
+
install = true
|
188
|
+
end
|
189
|
+
|
190
|
+
if install
|
191
|
+
$logger.info("Detected PDQTest 1.x file at #{pdk_file} (will upgrade to PDK)")
|
192
|
+
FileUtils.cp(upstream_file, pdk_file)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else
|
197
|
+
raise("error running PDK - unable to init")
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else
|
202
|
+
$logger.debug "PDK already enabled, no skeletons needed"
|
203
|
+
end
|
204
|
+
end
|
125
205
|
end
|
126
206
|
end
|
data/lib/pdqtest/upgrade.rb
CHANGED
@@ -2,7 +2,7 @@ require 'pdqtest/skeleton'
|
|
2
2
|
|
3
3
|
module PDQTest
|
4
4
|
module Upgrade
|
5
|
-
GEMFILE = 'Gemfile'
|
5
|
+
GEMFILE = 'Gemfile.project'
|
6
6
|
GEM_REGEXP = /gem ('|")([-\w]+)('|").*$/
|
7
7
|
GEM_ATTRIB_REGEXP = /^\s*:\w+/
|
8
8
|
|
@@ -15,10 +15,6 @@ module PDQTest
|
|
15
15
|
'line' => "gem 'puppet-strings', :git => 'https://github.com/puppetlabs/puppet-strings'",
|
16
16
|
'added' => false,
|
17
17
|
},
|
18
|
-
'puppet' => {
|
19
|
-
'line' => "gem 'puppet', '#{PDQTest::PUPPET_VERSION}'",
|
20
|
-
'added' => false,
|
21
|
-
}
|
22
18
|
}
|
23
19
|
|
24
20
|
|
@@ -27,50 +23,54 @@ module PDQTest
|
|
27
23
|
t_file = File.open("#{GEMFILE}.tmp","w")
|
28
24
|
updating_gem = false
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
elsif updating_gem and line =~ GEM_ATTRIB_REGEXP
|
49
|
-
# do nothing - remove the multi-line attributes
|
26
|
+
# Step 1 - enable gem
|
27
|
+
|
28
|
+
if ! File.exists?(GEMFILE)
|
29
|
+
FileUtils.touch(GEMFILE)
|
30
|
+
end
|
31
|
+
File.open(GEMFILE, 'r') do |f|
|
32
|
+
f.each_line{ |line|
|
33
|
+
if line =~ GEM_REGEXP
|
34
|
+
# a gem stanza
|
35
|
+
processing_gem = $2
|
36
|
+
if GEMS.keys.include?(processing_gem)
|
37
|
+
# fixup one of our monitored gems as needed, mark
|
38
|
+
# this as being a gem that is being updated so
|
39
|
+
# that we can kill any multi-line attributes
|
40
|
+
t_file.puts GEMS[processing_gem]['line']
|
41
|
+
updating_gem = true
|
42
|
+
GEMS[processing_gem]['added'] = true
|
50
43
|
else
|
51
|
-
#
|
44
|
+
# a gem we don't care about - write it out as-is
|
52
45
|
t_file.puts line
|
46
|
+
updating_gem = false
|
53
47
|
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
# for any that are not already added and append them
|
60
|
-
GEMS.each { |name, opts|
|
61
|
-
if ! opts['added']
|
62
|
-
t_file.puts opts['line']
|
48
|
+
elsif updating_gem and line =~ GEM_ATTRIB_REGEXP
|
49
|
+
# do nothing - remove the multi-line attributes
|
50
|
+
else
|
51
|
+
# anything else... (esp comments)
|
52
|
+
t_file.puts line
|
63
53
|
end
|
64
54
|
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# the code above will only UPGRADE existing gem lines, but if this is our
|
58
|
+
# first run, there will be nothing to upgrade, so loop through the GEMS
|
59
|
+
# for any that are not already added and append them
|
60
|
+
GEMS.each { |name, opts|
|
61
|
+
if ! opts['added']
|
62
|
+
t_file.puts opts['line']
|
63
|
+
end
|
64
|
+
}
|
65
65
|
|
66
|
-
|
67
|
-
FileUtils.mv(t_file.path, GEMFILE)
|
66
|
+
t_file.close
|
68
67
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
# Must do copy->delete on windows or we get permanent file not found
|
69
|
+
# error...
|
70
|
+
FileUtils.cp(t_file.path, GEMFILE)
|
71
|
+
FileUtils.rm(t_file.path)
|
72
|
+
|
73
|
+
PDQTest::Skeleton.upgrade
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
data/lib/pdqtest/util.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module PDQTest
|
2
2
|
module Util
|
3
|
+
ENV='export TERM=xterm LC_ALL=C PATH=/usr/local/bats/bin:/opt/puppetlabs/puppet/bin:$PATH;'
|
3
4
|
|
4
5
|
def self.resource_path(resource)
|
5
|
-
|
6
|
+
joinp(File.dirname(File.expand_path(__FILE__)), "../../res/#{resource}")
|
6
7
|
end
|
7
8
|
|
8
9
|
def self.app_dir
|
@@ -10,7 +11,86 @@ module PDQTest
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.app_dir_expanded
|
13
|
-
|
14
|
+
joinp(Dir.home, app_dir)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.host_platform
|
18
|
+
Gem.win_platform? ? :windows : :linux
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.is_windows
|
22
|
+
host_platform == :windows
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.shell
|
26
|
+
# cmd.exe is basically broken under docker, use powershell
|
27
|
+
is_windows ? "powershell" : "bash"
|
28
|
+
end
|
29
|
+
|
30
|
+
# need to wrap commands with shell to gain access to
|
31
|
+
# shell functions like `cd` etc
|
32
|
+
def self.wrap_cmd(cmd)
|
33
|
+
if cmd =~ /^\s*$/ || cmd == "bash" || cmd == "powershell"
|
34
|
+
raise "Missing command to wrap!"
|
35
|
+
end
|
36
|
+
|
37
|
+
if is_windows
|
38
|
+
wrapped = [shell, "-command", "#{cmd} ; exit $LastExitCode"]
|
39
|
+
else
|
40
|
+
wrapped = [shell, "-c", "#{ENV} #{cmd}"]
|
41
|
+
end
|
42
|
+
|
43
|
+
wrapped
|
44
|
+
end
|
45
|
+
|
46
|
+
# File.join joins paths with `/` _always_ so we must create our own
|
47
|
+
# function to join paths correctly for windows since using `/` in docker
|
48
|
+
# is not gonna work
|
49
|
+
def self.joinp(*args)
|
50
|
+
File.join(args).gsub(File::SEPARATOR,
|
51
|
+
File::ALT_SEPARATOR || File::SEPARATOR)
|
52
|
+
end
|
53
|
+
|
54
|
+
# 3x" --> 1x" seems only way to escape quotes to keep cmd.exe happy. also
|
55
|
+
# need to use double quotes for all args or they get eaten
|
56
|
+
def self.rm(f)
|
57
|
+
is_windows ? "if (test-path '#{f}'){ Remove-Item '#{f}' -Recurse -Force}" : "rm -rf #{f}"
|
58
|
+
end
|
59
|
+
|
60
|
+
# @param link the symlink file
|
61
|
+
# @param target the real file
|
62
|
+
def self.mk_link(link, target)
|
63
|
+
$logger.debug "symlink: #{link} <==> #{target}"
|
64
|
+
if Util.is_windows
|
65
|
+
Emoji.emoji_message(
|
66
|
+
:shame,
|
67
|
+
"symlinks not supported by ruby/puppet on windows doing COPY instead")
|
68
|
+
# broken until ruby/puppet fixed cmd = "#{rm(link)} ; cmd /C mklink /D '#{link}' '#{target}'"
|
69
|
+
|
70
|
+
# for regular files use `copy-time`, for trees use `robocopy` - since
|
71
|
+
# files are in the container we have no idea what is a file or not so
|
72
|
+
# just guess based on presence of filename extension
|
73
|
+
if link =~ /\.[\w]+$/
|
74
|
+
cmd = "copy-item '#{target}' -destination '#{link}'"
|
75
|
+
else
|
76
|
+
cmd = "robocopy '#{target}' '#{link}' /NFL /NDL /NJH /NJS /nc /ns /np /MIR /XD .git fixtures"
|
77
|
+
end
|
78
|
+
else
|
79
|
+
cmd = "#{rm(link)} && mkdir -p #{File.dirname(link)} && ln -s #{target} #{link}"
|
80
|
+
end
|
81
|
+
|
82
|
+
cmd
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.volumes2binds(volumes)
|
86
|
+
# {test_dir => {pwd => 'rw'} + VOLUMES
|
87
|
+
# ...to...
|
88
|
+
# "pwd:test_dir:rw",
|
89
|
+
volumes.map { |container_dir, host_mapping|
|
90
|
+
host_mapping.map { |dir, mode|
|
91
|
+
"#{dir}:#{container_dir}:#{mode}"
|
92
|
+
}.first
|
93
|
+
}
|
14
94
|
end
|
15
95
|
end
|
16
96
|
end
|
data/lib/pdqtest/version.rb
CHANGED
data/pdqtest.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "pdqtest"
|
8
8
|
spec.version = PDQTest::VERSION
|
9
9
|
spec.authors = ["Geoff Williams"]
|
10
|
-
spec.email = ["geoff
|
10
|
+
spec.email = ["geoff@declarativesystems.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Quick and simple integration tests run inside of a docker container}
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/DeclarativeSystems/pdqtest"
|
14
14
|
spec.licenses = 'Apache-2.0'
|
15
15
|
|
16
16
|
# file MUST be in git to be fucking readable!!!!!
|
@@ -21,22 +21,17 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
25
|
spec.add_development_dependency "coveralls", "0.8.21"
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "puppet", "5.3.5"
|
26
|
+
spec.add_development_dependency "rspec", "3.7.0"
|
28
27
|
|
29
28
|
spec.add_runtime_dependency "rake", "12.3.1"
|
30
|
-
spec.add_runtime_dependency "rspec", "3.7.0"
|
31
29
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
32
30
|
spec.add_runtime_dependency "minitar", "0.6.1"
|
33
|
-
spec.add_runtime_dependency "hiera", "3.4.2"
|
34
31
|
spec.add_runtime_dependency "escort", "0.4.0"
|
35
32
|
spec.add_runtime_dependency "docker-api", "1.34.2"
|
36
|
-
spec.add_runtime_dependency "
|
37
|
-
spec.add_runtime_dependency "
|
38
|
-
spec.add_runtime_dependency "
|
39
|
-
spec.add_runtime_dependency "
|
40
|
-
spec.add_runtime_dependency "git_refresh", "0.1.1"
|
41
|
-
spec.add_runtime_dependency "puppet_factset", "0.5.0"
|
33
|
+
spec.add_runtime_dependency "r10k", "2.6.4"
|
34
|
+
spec.add_runtime_dependency "logging", "~> 2.2"
|
35
|
+
spec.add_runtime_dependency "deep_merge", "~> 1.2"
|
36
|
+
spec.add_runtime_dependency "json", "<= 2.0.4"
|
42
37
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/res/skeleton/Makefile
CHANGED
@@ -1,11 +1,26 @@
|
|
1
|
-
all:
|
1
|
+
all: Gemfile.local
|
2
2
|
bundle exec pdqtest all
|
3
|
-
bundle exec puppet strings generate --format=markdown
|
4
3
|
|
5
|
-
|
4
|
+
fast: Gemfile.local
|
5
|
+
bundle exec pdqtest fast
|
6
|
+
|
7
|
+
shell: Gemfile.local
|
6
8
|
bundle exec pdqtest --keep-container acceptance
|
7
9
|
|
8
|
-
|
10
|
+
shellnopuppet: Gemfile.local
|
11
|
+
bundle exec pdqtest shell
|
12
|
+
|
13
|
+
logical: Gemfile.local
|
9
14
|
bundle exec pdqtest syntax
|
10
|
-
bundle exec pdqtest lint
|
11
15
|
bundle exec pdqtest rspec
|
16
|
+
|
17
|
+
bundle:
|
18
|
+
pdk bundle install
|
19
|
+
|
20
|
+
Gemfile.local:
|
21
|
+
echo "[🐌] Creating symlink and running pdk bundle..."
|
22
|
+
ln -s Gemfile.project Gemfile.local
|
23
|
+
make bundle
|
24
|
+
|
25
|
+
|
26
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<#
|
2
|
+
.SYNOPSIS
|
3
|
+
Run PDQTest targets
|
4
|
+
.DESCRIPTION
|
5
|
+
See the instructions at https://github.com/declarativesystems/pdqtest/blob/master/doc/running_tests.md
|
6
|
+
.EXAMPLE
|
7
|
+
.\make.ps1 - Run the default testing target
|
8
|
+
.EXAMPLE
|
9
|
+
.\make.ps1 XXX - run the XXX target
|
10
|
+
.PARAMETER target
|
11
|
+
Test suite to run
|
12
|
+
#>
|
13
|
+
param(
|
14
|
+
$target = "all"
|
15
|
+
)
|
16
|
+
|
17
|
+
$gfl = "Gemfile.local"
|
18
|
+
$gfp = "Gemfile.project"
|
19
|
+
|
20
|
+
# Relink Gemfile.local
|
21
|
+
# https://github.com/declarativesystems/pdqtest/blob/master/doc/pdk.md#why-are-the-launch-scripts-essentialhow-does-the-pdqtest-gem-load-itself
|
22
|
+
function Install-GemfileLocal {
|
23
|
+
# on windows, symlinks dont work on vagrant fileshares, so just copy the
|
24
|
+
# file if needed
|
25
|
+
if (Test-Path $gfl) {
|
26
|
+
$gflMd5 = (Get-FileHash -Path $gfl -Algorithm MD5).Hash
|
27
|
+
$gfpMd5 = (Get-FileHash -Path $gfp -Algorithm MD5).Hash
|
28
|
+
if ($gflMd5 -eq $gfpMd5) {
|
29
|
+
# OK - ready to launch
|
30
|
+
} else {
|
31
|
+
write-error "$($gfl) different content to $($gfp)! Move it out the way or move the content to $($gfp)"
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
write-host "[(-_-)zzz] Copying $($gfp) to $($gfl) and running pdk bundle..."
|
35
|
+
copy $gfp $gfl
|
36
|
+
pdk bundle install
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
switch ($target) {
|
42
|
+
"all" {
|
43
|
+
Install-GemfileLocal
|
44
|
+
bundle exec pdqtest all
|
45
|
+
}
|
46
|
+
"fast" {
|
47
|
+
Install-GemfileLocal
|
48
|
+
bundle exec pdqtest fast
|
49
|
+
}
|
50
|
+
"shell" {
|
51
|
+
Install-GemfileLocal
|
52
|
+
bundle exec pdqtest --keep-container acceptance
|
53
|
+
}
|
54
|
+
"shellnopuppet" {
|
55
|
+
Install-GemfileLocal
|
56
|
+
bundle exec pdqtest shell
|
57
|
+
}
|
58
|
+
"logical" {
|
59
|
+
Install-GemfileLocal
|
60
|
+
bundle exec pdqtest syntax
|
61
|
+
bundle exec pdqtest rspec
|
62
|
+
}
|
63
|
+
default {
|
64
|
+
Write-Error "No such target: $($target)"
|
65
|
+
}
|
66
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Hiera 5 Global configuration file *****test configuration*****
|
2
|
+
#
|
3
|
+
# Hiera data expected from spec/fixtures/hieradata to give consistent path for
|
4
|
+
# testing both rspec and acceptance
|
5
|
+
---
|
6
|
+
|
7
|
+
version: 5
|
8
|
+
|
9
|
+
hierarchy:
|
10
|
+
- name: 'Yaml backend'
|
11
|
+
data_hash: yaml_data
|
12
|
+
paths:
|
13
|
+
- '/spec/fixtures/hieradata/test.yaml'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# test.yaml *****for testing*****
|
2
|
+
#
|
3
|
+
# This allows you to acceptance test the _global_ hierarchy. Usually this is not
|
4
|
+
# what you want- for in-module data, just look at `/hiera.yaml` and `/data`
|
5
|
+
#
|
6
|
+
# There may be edge cases where this is useful - don't forget double check that
|
7
|
+
# * `/spec/fixtures/hiera.yaml`
|
8
|
+
# * `/spec/fixtures/hieradata/*`
|
9
|
+
# Have really made it to git. They are often excluded via `.gitignore`
|
10
|
+
---
|
11
|
+
message: "this is a test message from pdqtest/hiera"
|
@@ -1,2 +1,2 @@
|
|
1
|
-
#<%= PDQTest::Puppet::
|
1
|
+
#<%= PDQTest::Puppet::setting(:magic_marker) %>
|
2
2
|
include <%= PDQTest::Puppet.module_name %>
|