pdqtest 0.8.4 → 0.9.0

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
  SHA1:
3
- metadata.gz: 95fb5fc14bbce484b01b0527d3b9b7fadf4d3fc0
4
- data.tar.gz: 7086b24ca80b133ecda24ce58d6e2b633ac70d57
3
+ metadata.gz: 59cfe8a4a7a28734f02acac84965152cb9e28197
4
+ data.tar.gz: 1b70cf001fc4a3b622990c0f128ff4a6099800e6
5
5
  SHA512:
6
- metadata.gz: e40c39f1382f86100cd1e77f93a446d2512100ce6155e1305411319221c64f01f888cb147415e7de5a98a105c6e6616b1fde3bf2e1807c4ee593be7b05e69264
7
- data.tar.gz: aa3faf0a0c0d74045d1df89e6fc50eafbf9f09176ab56fe2ede034bbceeb18653f2242dd2ae3e54b9dc04232c583d009ebe7ea4b7817be710d879fb3d4c71937
6
+ metadata.gz: 364b23efc25433b0cf82a4d4c4f3e1d91302f90daffad172cc462905254c5cab2626b0512a5940048b693cee7bdc199b18f37c56dd6e6d94d78151a79b7ed6ed
7
+ data.tar.gz: d0b0a259cfcbb34dc9f157405a1fbafb45f54e52b6465ac531006c64133a37384487b978a1258d59e46039ce4a9db79bc0c0fe0bbefd20fd3ef9c16ee79b9732
data/exe/pdqtest CHANGED
@@ -49,6 +49,14 @@ Escort::App.create do |app|
49
49
  :type => :boolean,
50
50
  :default => false,
51
51
  )
52
+
53
+ opts.opt(:skip_idempotency,
54
+ 'Dont check idempotency (run only once)',
55
+ :long => '--skip-idempotency',
56
+ :type => :boolean,
57
+ :default => false,
58
+ )
59
+
52
60
  end
53
61
 
54
62
  app.command :all do |command|
@@ -56,6 +64,7 @@ Escort::App.create do |app|
56
64
  command.description "Run all tests"
57
65
  command.action do |options, arguments|
58
66
  PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
67
+ PDQTest::Puppet.skip_second_run(options[:global][:options][:skip_idempotency])
59
68
 
60
69
  PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
61
70
  PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
@@ -92,6 +101,7 @@ Escort::App.create do |app|
92
101
  end
93
102
  command.action do |options, arguments|
94
103
  PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
104
+ PDQTest::Puppet.skip_second_run(options[:global][:options][:skip_idempotency])
95
105
  PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
96
106
  PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
97
107
  example = options[:global][:commands][:acceptance][:options][:example]
@@ -20,8 +20,13 @@ module PDQTest
20
20
  CLASS_RE = /^class /
21
21
  @@bats_executed = []
22
22
  @@setup_executed = []
23
+ @@skip_second_run = false
23
24
  FIXTURES = 'fixtures.yml'
24
25
 
26
+ def self.skip_second_run(skip_second_run)
27
+ @@skip_second_run = skip_second_run
28
+ end
29
+
25
30
  def self.reset_bats_executed
26
31
  @@bats_executed = []
27
32
  end
@@ -212,15 +217,22 @@ module PDQTest
212
217
  PDQTest::Docker.log_out(res)
213
218
  if PDQTest::Docker.exec_status(res, true) # allow 2 as exit status
214
219
 
215
- # run puppet apply - 2nd run (check for idempotencey/no more changes)
216
- res = PDQTest::Docker.exec(container, puppet_apply(example))
217
- PDQTest::Docker.log_out(res)
220
+ if @@skip_second_run
221
+ Escort::Logger.output.puts "Skipping idempotency check as you requested..."
218
222
 
219
- # run the bats test if nothing failed yet
220
- if PDQTest::Docker.exec_status(res) # only allow 0 as exit status
223
+ # check the system right now since puppet ran OK once
221
224
  status = bats_test(container, example, AFTER_SUFFIX)
222
225
  else
223
- Escort::Logger.error.error "Not idempotent: #{example}"
226
+ # run puppet apply - 2nd run (check for idempotencey/no more changes)
227
+ res = PDQTest::Docker.exec(container, puppet_apply(example))
228
+ PDQTest::Docker.log_out(res)
229
+
230
+ # run the bats test if nothing failed yet
231
+ if PDQTest::Docker.exec_status(res) # only allow 0 as exit status
232
+ status = bats_test(container, example, AFTER_SUFFIX)
233
+ else
234
+ Escort::Logger.error.error "Not idempotent: #{example}"
235
+ end
224
236
  end
225
237
  else
226
238
  Escort::Logger.error.error "First puppet run of #{example} failed"
@@ -1,3 +1,3 @@
1
1
  module PDQTest
2
- VERSION = "0.8.4"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdqtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-24 00:00:00.000000000 Z
11
+ date: 2017-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler