pdqtest 1.9.9beta4 → 1.9.9beta5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1825d421c28096e7d5ccf9d0e235905a59e5ae7dba50e424a62959c7738b3101
4
- data.tar.gz: 608f8fcef51637ea0bc51eb7b2cc9017fc3445b380fbc53ab42cd04de8f6212e
3
+ metadata.gz: 2a9b6fed071d96aaf5e9be2d817ef816dc0a4ba8e56e93413a1c40889225fd03
4
+ data.tar.gz: 31d2c4d2eaf7a731dcb72d62a0cf84d5257e7de755c87a7531b7fc1414329f7f
5
5
  SHA512:
6
- metadata.gz: fffc15198639ff6a435d9c801544f986024578a28c52a700d5f754b253ef191c180b37fa84f6d0eba955e5546782a043366a42460035120fdd979aba166e5543
7
- data.tar.gz: 47770f9efc8f717b08222bfeb3f26d57897be2a0f81d58041927dc5860de0b2b8cf83feb1b894554f38fd3fd527e2d2071542e3eb96cf6b2eaa6b29d31c1f1fa
6
+ metadata.gz: 8565026a8c28a794fe58c26065de33bd17c62daab57fc917af5d5742cecea6c9f7508a51fab8de0fbd763ff6c7ea89be1c7bc1b43049479a71073eaa05306509
7
+ data.tar.gz: e6aa081aa4de254977b034327c85090b0c9e0dd3c1e75131af26eab434fec8a80730699ec03b4852f936d8d07cb83d630ff3411675c8a420c38c9e6b7fdca4a9
data/exe/pdqtest CHANGED
@@ -23,8 +23,6 @@ require 'pdqtest/fastcheck'
23
23
  # display help if nothing specified
24
24
  ARGV.push('-h') if ARGV.empty?
25
25
 
26
- # Setup our own hacky logger
27
-
28
26
 
29
27
  Escort::App.create do |app|
30
28
  app.version PDQTest::VERSION
@@ -88,15 +86,15 @@ Escort::App.create do |app|
88
86
  PDQTest::Instance.set_privileged(options[:global][:options][:privileged])
89
87
  PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
90
88
  PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
91
-
92
- PDQTest::Core.run([
93
- lambda {PDQTest::Pdk.run("validate 'metadata,puppet'")},
94
- lambda {PDQTest::Puppet.install_modules},
95
- lambda {PDQTest::Pdk.run("test unit")},
96
- lambda {PDQTest::Instance.run},
97
- lambda {system("bundle exec puppet strings generate --format=markdown")},
98
- lambda {PDQTest::Pdk.run("build --force")},
99
- ])
89
+ Dir.chdir ".." do
90
+ PDQTest::Core.run([
91
+ lambda {PDQTest::Pdk.run("validate 'metadata,puppet'")},
92
+ lambda {PDQTest::Puppet.install_modules},
93
+ lambda {PDQTest::Pdk.run("test unit")},
94
+ lambda {PDQTest::Instance.run},
95
+ lambda {PDQTest::Pdk.run("build --force")},
96
+ ])
97
+ end
100
98
  end
101
99
  end
102
100
 
@@ -114,12 +112,13 @@ Escort::App.create do |app|
114
112
  PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
115
113
  PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
116
114
 
117
- PDQTest::Core.run([
118
- lambda {PDQTest::Fastcheck.run},
119
- lambda {PDQTest::Puppet.install_modules},
120
- lambda {PDQTest::Instance.run},
121
- lambda {system("bundle exec puppet strings generate --format=markdown")},
122
- ])
115
+ Dir.chdir ".." do
116
+ PDQTest::Core.run([
117
+ lambda {PDQTest::Fastcheck.run},
118
+ lambda {PDQTest::Puppet.install_modules},
119
+ lambda {PDQTest::Instance.run},
120
+ ])
121
+ end
123
122
  end
124
123
  end
125
124
 
@@ -131,7 +130,9 @@ Escort::App.create do |app|
131
130
  $logger.level = :debug if options[:global][:options][:debug]
132
131
 
133
132
  PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
134
- PDQTest::Core.run(lambda {PDQTest::Pdk.run("test unit")})
133
+ Dir.chdir ".." do
134
+ PDQTest::Core.run(lambda {PDQTest::Pdk.run("test unit")})
135
+ end
135
136
  end
136
137
  end
137
138
 
@@ -157,7 +158,9 @@ Escort::App.create do |app|
157
158
  PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
158
159
  PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
159
160
  example = options[:global][:commands][:acceptance][:options][:example]
160
- PDQTest::Core.run(lambda {PDQTest::Instance.run(example)})
161
+ Dir.chdir ".." do
162
+ PDQTest::Core.run(lambda {PDQTest::Instance.run(example)})
163
+ end
161
164
  end
162
165
  end
163
166
 
@@ -191,7 +194,9 @@ Escort::App.create do |app|
191
194
  PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
192
195
  example = options[:global][:commands][:generate_acceptance][:options][:example]
193
196
 
194
- PDQTest::Skeleton.generate_acceptance(example)
197
+ Dir.chdir ".." do
198
+ PDQTest::Skeleton.generate_acceptance(example)
199
+ end
195
200
  end
196
201
  end
197
202
 
@@ -216,7 +221,9 @@ Escort::App.create do |app|
216
221
  $logger.level = :debug if options[:global][:options][:debug]
217
222
 
218
223
  PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
219
- PDQTest::Core.run(lambda {PDQTest::Pdk.run("validate 'metadata,puppet'")})
224
+ Dir.chdir ".." do
225
+ PDQTest::Core.run(lambda {PDQTest::Pdk.run("validate 'metadata,puppet'")})
226
+ end
220
227
  end
221
228
  end
222
229
 
@@ -228,11 +235,13 @@ Escort::App.create do |app|
228
235
  PDQTest::Logger.logger
229
236
  $logger.level = :debug if options[:global][:options][:debug]
230
237
 
231
- PDQTest::Core.run(lambda {
232
- PDQTest::Docker::IMAGES.each { |key, image|
233
- system("docker pull #{image}")
234
- }
235
- })
238
+ Dir.chdir ".." do
239
+ PDQTest::Core.run(lambda {
240
+ PDQTest::Docker::IMAGES.each { |key, image|
241
+ system("docker pull #{image}")
242
+ }
243
+ })
244
+ end
236
245
  end
237
246
  end
238
247
 
@@ -243,7 +252,9 @@ Escort::App.create do |app|
243
252
  PDQTest::Logger.logger
244
253
  $logger.level = :debug if options[:global][:options][:debug]
245
254
 
246
- PDQTest::Puppet.info
255
+ Dir.chdir ".." do
256
+ PDQTest::Puppet.info
257
+ end
247
258
  end
248
259
  end
249
260
 
@@ -255,7 +266,9 @@ Escort::App.create do |app|
255
266
  PDQTest::Logger.logger
256
267
  $logger.level = :debug if options[:global][:options][:debug]
257
268
 
258
- PDQTest::Upgrade.upgrade
269
+ Dir.chdir ".." do
270
+ PDQTest::Upgrade.upgrade
271
+ end
259
272
  end
260
273
  end
261
274
  end
data/lib/pdqtest/pdk.rb CHANGED
@@ -61,11 +61,6 @@ module PDQTest
61
61
  ].include? e
62
62
  }
63
63
 
64
- # we must run build target nastyhack before running PDK on linux
65
- if ! Util.is_windows
66
- $logger.warn("Running nasty hack: https://tickets.puppetlabs.com/browse/PDK-1192")
67
- system("make nastyhack")
68
- end
69
64
  status = system(env, pdk, :unsetenv_others=>true)
70
65
 
71
66
  PDQTest::Emoji.partial_status(status, subcommand)
@@ -280,8 +280,8 @@ module PDQTest
280
280
  setup_script = Util.joinp(XATS_TESTS, test_basename(example)) + setting(:setup_suffix)
281
281
  if File.exists?(setup_script)
282
282
  script = File.read(setup_script)
283
-
284
- if script =~ /^\s*$/
283
+ $logger.debug "setup script: \n #{script}"
284
+ if script.strip.empty?
285
285
  $logger.info "skipping empty setup script at #{setup_script}"
286
286
  else
287
287
  $logger.info "Setting up test for #{example}"
@@ -44,8 +44,16 @@ module PDQTest
44
44
  def self.should_replace_file(target, skeleton)
45
45
  target_hash = Digest::SHA256.file target
46
46
  skeleton_hash = Digest::SHA256.file skeleton
47
-
48
- target_hash != skeleton_hash
47
+ puts Dir.pwd
48
+ puts target
49
+ puts skeleton
50
+ puts target_hash
51
+ puts skeleton_hash
52
+ puts Digest::SHA256.file "/nothere"
53
+ should = (target_hash != skeleton_hash)
54
+ $logger.debug "should replace: #{should}"
55
+
56
+ should
49
57
  end
50
58
 
51
59
  def self.install_skeletons
@@ -59,11 +67,14 @@ module PDQTest
59
67
  if File.exists?(target_file)
60
68
  if replace && should_replace_file(target_file, skeleton_file)
61
69
  install = true
70
+ else
71
+ $logger.debug "#{target_file} exists and will not be replaced"
62
72
  end
63
73
  else
64
74
  install = true
65
75
  end
66
76
  if install
77
+ $logger.debug "Installing skeleton file at #{target_file}"
67
78
  FileUtils.cp(skeleton_file, target_file)
68
79
  end
69
80
  end
@@ -2,7 +2,8 @@ require 'pdqtest/skeleton'
2
2
 
3
3
  module PDQTest
4
4
  module Upgrade
5
- GEMFILE = 'Gemfile.project'
5
+ GEMDIR = '.pdqtest'
6
+ GEMFILE = File.join(GEMDIR,'Gemfile')
6
7
  GEM_REGEXP = /gem ('|")([-\w]+)('|").*$/
7
8
  GEM_ATTRIB_REGEXP = /^\s*:\w+/
8
9
 
@@ -11,15 +12,22 @@ module PDQTest
11
12
  'line' => "gem 'pdqtest', '#{PDQTest::VERSION}'",
12
13
  'added' => false,
13
14
  },
14
- 'puppet-strings' => {
15
- 'line' => "gem 'puppet-strings', :git => 'https://github.com/puppetlabs/puppet-strings'",
16
- 'added' => false,
15
+ 'puppet-strings' => {
16
+ 'line' => "gem 'puppet-strings'",
17
+ 'added' => false,
18
+ },
19
+ 'puppet' => {
20
+ 'line' => "gem 'puppet'",
21
+ 'added' => false,
17
22
  },
18
23
  }
19
24
 
20
25
 
21
26
  # upgrade a module to the latest version of PDQTest
22
27
  def self.upgrade()
28
+ if ! Dir.exist?(GEMDIR)
29
+ Dir.mkdir GEMDIR
30
+ end
23
31
  t_file = File.open("#{GEMFILE}.tmp","w")
24
32
  updating_gem = false
25
33
 
data/lib/pdqtest/util.rb CHANGED
@@ -30,7 +30,7 @@ module PDQTest
30
30
  # need to wrap commands with shell to gain access to
31
31
  # shell functions like `cd` etc
32
32
  def self.wrap_cmd(cmd)
33
- if cmd =~ /^\s*$/ || cmd == "bash" || cmd == "powershell"
33
+ if cmd.strip.empty? || cmd == "bash" || cmd == "powershell"
34
34
  raise "Missing command to wrap!"
35
35
  end
36
36
 
@@ -1,3 +1,3 @@
1
1
  module PDQTest
2
- VERSION = "1.9.9beta4"
2
+ VERSION = "1.9.9beta5"
3
3
  end
@@ -1,33 +1,38 @@
1
- all: Gemfile.local
2
- bundle exec pdqtest all
1
+ all:
2
+ cd .pdqtest && bundle exec pdqtest all
3
+ $(MAKE) docs
3
4
 
4
- fast: Gemfile.local
5
- bundle exec pdqtest fast
5
+ fast:
6
+ cd .pdqtest && bundle exec pdqtest fast
6
7
 
7
- shell: Gemfile.local
8
- bundle exec pdqtest --keep-container acceptance
8
+ shell:
9
+ cd .pdqtest && bundle exec pdqtest --keep-container acceptance
9
10
 
10
- shellnopuppet: Gemfile.local
11
- bundle exec pdqtest shell
11
+ setup:
12
+ cd .pdqtest && bundle exec pdqtest setup
12
13
 
13
- logical: Gemfile.local
14
- bundle exec pdqtest syntax
15
- bundle exec pdqtest rspec
14
+ shellnopuppet:
15
+ cd .pdqtest && bundle exec pdqtest shell
16
+
17
+ logical:
18
+ cd .pdqtest && bundle exec pdqtest syntax
19
+ cd .pdqtest && bundle exec pdqtest rspec
20
+ $(MAKE) docs
16
21
 
17
22
  nastyhack:
18
23
  # fix for - https://tickets.puppetlabs.com/browse/PDK-1192
19
24
  find vendor -iname '*.pp' -exec rm {} \;
20
25
 
21
26
  bundle:
22
- # Obtain puppet 5x and lock
23
- pdk bundle install
24
27
  # Install all gems into _normal world_ bundle so we can use all of em
25
- bundle install
28
+ cd .pdqtest && bundle install
26
29
 
27
30
  Gemfile.local:
28
31
  echo "[🐌] Creating symlink and running pdk bundle..."
29
32
  ln -s Gemfile.project Gemfile.local
30
- make bundle
33
+
34
+ docs:
35
+ cd .pdqtest && bundle exec "cd ..&& puppet strings"
31
36
 
32
37
 
33
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdqtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.9beta4
4
+ version: 1.9.9beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Williams