pdqtest 1.9.9beta11 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d0d90f3af8c39a0195c66bc63db29c12a2a17fc6a84d3d82151b24a570ad1e8
4
- data.tar.gz: 6aaa15557cf39b16773ded05b3b4165eed0e5ec2cefa0cc9150abf95bb4931f6
3
+ metadata.gz: c613051273e1726c3eba61ccf83240240071febd92f389a3fc5deb9e450d731c
4
+ data.tar.gz: 653aed1411b01865e5dd0f4c496d83c9bb9154433685d2f8e4bf2d2de172f670
5
5
  SHA512:
6
- metadata.gz: 5b085a8730dab2447f943f78697b277e97173bc5c668e2e54897be454a614d3f011cca0346e579794319c82cd9dd39452db29b1f665da530419941594bfad86e
7
- data.tar.gz: '024703510449d147758d6df284baf29d82c6796e58f8432fbe1596c2e787f4cc399d1983ea9a2f4db5d84fd3feff46b7bfcc9b01dce08e0379bcdc3db20b792a'
6
+ metadata.gz: 3a7b3eacf0af556ffc739986183373131d2f5a152a3bcec8de23c83f8014f3149d65c2bd15970e95a8d5e319aafd20361f2bd8d41be479325d5664500c8111a5
7
+ data.tar.gz: 236a5130aed1412b3fd87e04dadf9e4787ad3069d6e30ff36f0244066a5e6b831c714ecfbcd018adcd6725fd7a9adf2a684b25433a22530f86f3e2628442943d
data/doc/installation.md CHANGED
@@ -26,10 +26,12 @@ PDQTest and Docker.
26
26
  4. Install PDQTest - `gem install pdqtest`
27
27
  5. Install bundler (the only sane way to manage Ruby dependencies)
28
28
  `gem install bundler`
29
- 6. Install [Docker CE](www.docker.com)
30
- 7. Start the `docker` daemon and make sure the user your running as is in the
29
+ 7 Add PDK to your path (add to `.profile` for permanent):
30
+ `export PATH=/opt/puppetlabs/pdk/bin/:$PATH`
31
+ 8. Install [Docker CE](www.docker.com)
32
+ 9. Start the `docker` daemon and make sure the user your running as is in the
31
33
  `docker` group. You will need to log out and back in again after doing this
32
- 8. Install the PDQTest docker images by typing `pdqtest setup`
34
+ 10. Install the PDQTest docker images by typing `pdqtest setup`
33
35
 
34
36
  ## Mac instructions
35
37
  **UNTESTED! Do you own a mac? Please let me know what works**
data/doc/pdk.md CHANGED
@@ -337,3 +337,9 @@ With PDK!:
337
337
  ```shell
338
338
  pdk validate -a
339
339
  ```
340
+
341
+ ## What's going on with Puppet Strings?
342
+ We use our own gem version of `puppet` and `puppet-strings` because
343
+ `puppet-strings` is not shipped by PDK.
344
+
345
+ We execute `puppet strings` outside of ruby for simplicity.
data/doc/running_tests.md CHANGED
@@ -43,6 +43,8 @@ an argument from this table:
43
43
  * no: we run an alternative command
44
44
  * -: There is no corresponding `pdk` command
45
45
 
46
+ Fast mode requires `puppet` in your path (not installed via gem).
47
+
46
48
  **Examples**
47
49
 
48
50
  Test the module as quickly as possible:
@@ -36,7 +36,7 @@ RUN apt-get update && apt-get install -y cron \
36
36
  RUN echo 'LANG=en_US.UTF-8' > /etc/locale.conf
37
37
  ENV LANG en_US.UTF-8
38
38
  ENV LC_ALL en_US.UTF-8
39
- ENV PATH /usr/local/bats/bin:/opt/puppetlabs/puppet/bin/:/usr/sbin:/sbin:/usr/bin:/bin
39
+ ENV PATH /usr/local/bats/bin:/usr/sbin:/sbin:/usr/bin:/bin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/pdk/bin
40
40
  ENV TERM xterm
41
41
 
42
42
  # puppet (and dont run the daemons)
@@ -60,5 +60,18 @@ VOLUME /testcase
60
60
  # hiera
61
61
  RUN mkdir -p /spec/fixtures/
62
62
 
63
+ # PDK
64
+ RUN curl -O https://apt.puppetlabs.com/puppet5-release-trusty.deb && \
65
+ dpkg -i puppet5-release-trusty.deb && \
66
+ apt-get update && \
67
+ apt install -y pdk
68
+
69
+ # ruby
70
+ RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
71
+ RUN curl -sSL https://get.rvm.io | bash -s stable
72
+ RUN echo "source /etc/profile.d/rvm.sh" >> ~/.bashrc
73
+ RUN /bin/bash -c "source /etc/profile.d/rvm.sh ; rvm install 2.4.1"
74
+ RUN /bin/bash -c "source /etc/profile.d/rvm.sh ; gem install bundler ; bundle --version"
75
+
63
76
  # alternate shudown for systemd
64
77
  STOPSIGNAL SIGRTMIN+3
@@ -10,7 +10,7 @@ module PDQTest
10
10
 
11
11
  IMAGES = {
12
12
  :DEFAULT => 'declarativesystems/pdqtest-centos:2018-09-15-0',
13
- :UBUNTU => 'declarativesystems/pdqtest-ubuntu:2018-09-15-0',
13
+ :UBUNTU => 'declarativesystems/pdqtest-ubuntu:2018-10-06-0',
14
14
  :WINDOWS => 'declarativesystems/pdqtest-windows:2018-09-30-0',
15
15
  }
16
16
 
@@ -20,23 +20,19 @@ module PDQTest
20
20
 
21
21
  def self._exec_real(container, real_c)
22
22
  res = {}
23
-
24
23
  res[:OUT] = []
25
24
  res[:ERR] = []
26
25
  res[:STATUS] = 0
27
26
  $logger.debug("exec_real: running inplace command: #{real_c}")
28
27
  if @@enable
29
- # must splat to avoid "wrong first argument"
30
- # Open3.popen3(*real_c) do |stdin, stdout, stderr, wait_thr|
31
- # res[:OUT] = stdout.read.split("\n")
32
- # res[:ERR] = stderr.read.split("\n")
33
- # # Process::Status object returned from `.value`
34
- # res[:STATUS] = wait_thr.value.exitstatus
35
- # end
36
- stdout, stderr, status = Open3.capture3(*real_c)
28
+ # OMG ruby... https://dmerej.info/blog/post/why-i-dont-like-ruby/
29
+ stdout, stderr, status = Open3.capture3(
30
+ Util.clean_env, *real_c, unsetenv_others: true
31
+ )
32
+
33
+ res[:STATUS] = status.exitstatus
37
34
  res[:OUT] = stdout.split("\n")
38
35
  res[:ERR] = stderr.split("\n")
39
- res[:STATUS] = status.exitstatus
40
36
  else
41
37
  $logger.info "didn't run command, reason: DISABLED"
42
38
  end
@@ -89,7 +89,7 @@ module PDQTest
89
89
  test_platforms = [PDQTest::Inplace::INPLACE_IMAGE]
90
90
  cc = PDQTest::Inplace
91
91
  else
92
- test_platforms = get_acceptance_test_images
92
+ test_platforms = get_acceptance_test_images.uniq
93
93
  cc = PDQTest::Docker
94
94
  end
95
95
 
data/lib/pdqtest/pdk.rb CHANGED
@@ -33,35 +33,8 @@ module PDQTest
33
33
  PDQTest::Puppet.fixtures_yml
34
34
  end
35
35
 
36
- # on windows our environment is heavly contaminated by bundler - we have
37
- # to remove it's environment or pdk command will flatout refuse to run
38
- # probably doens't hurt to do this on linux too.
39
- env = ENV.reject { |e|
40
- [
41
- "BUNDLER_ORIG_BUNDLER_ORIG_MANPATH",
42
- "BUNDLER_ORIG_BUNDLER_VERSION",
43
- "BUNDLER_ORIG_BUNDLE_BIN_PATH",
44
- "BUNDLER_ORIG_BUNDLE_GEMFILE",
45
- "BUNDLER_ORIG_GEM_HOME",
46
- "BUNDLER_ORIG_GEM_PATH",
47
- "BUNDLER_ORIG_MANPATH",
48
- "BUNDLER_ORIG_PATH",
49
- "BUNDLER_ORIG_RB_USER_INSTALL",
50
- "BUNDLER_ORIG_RUBYLIB",
51
- "BUNDLER_ORIG_RUBYOPT",
52
- "BUNDLER_VERSION",
53
- "BUNDLE_BIN_PATH",
54
- "BUNDLE_GEMFILE",
55
- "GEM_HOME",
56
- "GEM_PATH",
57
- "MANPATH",
58
- "PROMPT",
59
- "RUBYLIB",
60
- "RUBYOPT",
61
- ].include? e
62
- }
63
-
64
- status = system(env, pdk, :unsetenv_others=>true)
36
+ # our environment is heavly contaminated by bundler and maybe RVM too
37
+ status = system(Util.clean_env, pdk, unsetenv_others: true)
65
38
 
66
39
  PDQTest::Emoji.partial_status(status, subcommand)
67
40
  status
@@ -139,6 +139,7 @@ module PDQTest
139
139
  install_skeleton('bitbucket-pipelines.yml', 'bitbucket-pipelines.yml')
140
140
  install_skeleton('.travis.yml', '.travis.yml')
141
141
  install_skeleton('appveyor.yml', 'appveyor.yml')
142
+ install_skeleton('.ci_custom.sh', '.ci_custom.sh', false)
142
143
  Pdk.amend_sync_yml(SYNC_YML_CONTENT)
143
144
  end
144
145
 
@@ -16,11 +16,7 @@ module PDQTest
16
16
  'added' => false,
17
17
  },
18
18
  'puppet-strings' => {
19
- 'line' => "gem 'puppet-strings'",
20
- 'added' => false,
21
- },
22
- 'puppet' => {
23
- 'line' => "gem 'puppet', '5.5.6'",
19
+ 'line' => "gem 'puppet-strings', '2.1.0'",
24
20
  'added' => false,
25
21
  },
26
22
  'puppet-lint' => {
@@ -39,6 +35,10 @@ module PDQTest
39
35
  'line' => "gem 'rake', '12.3.1'",
40
36
  'added' => false,
41
37
  },
38
+ 'puppet' => {
39
+ 'line' => "gem 'puppet', '6.0.2'",
40
+ 'added' => false,
41
+ },
42
42
  }.freeze
43
43
 
44
44
 
data/lib/pdqtest/util.rb CHANGED
@@ -1,6 +1,6 @@
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
+ PDQENV = 'export TERM=xterm LC_ALL=C PATH=/usr/local/bats/bin:/opt/puppetlabs/puppet/bin:$PATH;'
4
4
 
5
5
  def self.resource_path(resource)
6
6
  joinp(File.dirname(File.expand_path(__FILE__)), "../../res/#{resource}")
@@ -37,7 +37,7 @@ module PDQTest
37
37
  if is_windows
38
38
  wrapped = [shell, "-command", "#{cmd} ; exit $LastExitCode"]
39
39
  else
40
- wrapped = [shell, "-c", "#{ENV} #{cmd}"]
40
+ wrapped = [shell, "-c", "#{PDQENV} #{cmd}"]
41
41
  end
42
42
 
43
43
  wrapped
@@ -92,5 +92,43 @@ module PDQTest
92
92
  }.first
93
93
  }
94
94
  end
95
+
96
+ # environment - rvm and bundler 🤮
97
+ def self.clean_env
98
+ env = ENV.reject { |e|
99
+ [
100
+ "BUNDLER_ORIG_BUNDLER_ORIG_MANPATH",
101
+ "BUNDLER_ORIG_BUNDLER_VERSION",
102
+ "BUNDLER_ORIG_BUNDLE_BIN_PATH",
103
+ "BUNDLER_ORIG_BUNDLE_GEMFILE",
104
+ "BUNDLER_ORIG_GEM_HOME",
105
+ "BUNDLER_ORIG_GEM_PATH",
106
+ "BUNDLER_ORIG_MANPATH",
107
+ "BUNDLER_ORIG_PATH",
108
+ "BUNDLER_ORIG_RB_USER_INSTALL",
109
+ "BUNDLER_ORIG_RUBYLIB",
110
+ "BUNDLER_ORIG_RUBYOPT",
111
+ "BUNDLER_VERSION",
112
+ "BUNDLE_BIN_PATH",
113
+ "BUNDLE_GEMFILE",
114
+ "GEM_HOME",
115
+ "GEM_PATH",
116
+ "MANPATH",
117
+ "PROMPT",
118
+ "RUBYLIB",
119
+ "RUBYOPT",
120
+
121
+ # more random crap
122
+ "rvm_bin_path",
123
+ "IRBRC",
124
+ "MY_RUBY_HOME",
125
+ "rvm_path",
126
+ "rvm_prefix",
127
+ "RUBY_VERSION"
128
+ ].include? e
129
+ }
130
+
131
+ env
132
+ end
95
133
  end
96
134
  end
@@ -1,3 +1,3 @@
1
1
  module PDQTest
2
- VERSION = "1.9.9beta11"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -2,24 +2,23 @@
2
2
  # To run locally:
3
3
  # https://confluence.atlassian.com/bitbucket/debug-your-pipelines-locally-with-docker-838273569.html
4
4
  ---
5
- image: ruby:2.4.1
5
+ image: declarativesystems/pdqtest-ubuntu:2018-10-06-0
6
6
 
7
7
  pipelines:
8
8
  default:
9
- - step:
10
- caches:
11
- - bundler
12
- script:
13
- - ruby --version
14
- - bundler --version
15
- - wget https://apt.puppetlabs.com/puppet5-release-trusty.deb
16
- - dpkg -i puppet5-release-trusty.deb
17
- - apt-get update
18
- - apt install -y pdk
19
- - sh .ci_custom.sh
20
- - make pdqtestbundle
21
- - cd .pdqtest && bundle exec pdqtest --inplace --inplace-enable all
9
+ - step:
10
+ caches:
11
+ - bundler
12
+ script:
13
+ - source /etc/profile.d/rvm.sh
14
+ - ruby --version
15
+ - which ruby
16
+ - bundler --version
17
+ - sh .ci_custom.sh
18
+ - make pdqtestbundle
19
+ - cd .pdqtest && bundle exec pdqtest --inplace --inplace-enable all
22
20
 
23
21
  definitions:
24
22
  caches:
25
23
  bundler: vendor/bundle
24
+
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: 1.9.9beta11
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2018-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -253,9 +253,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
253
  version: '0'
254
254
  required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  requirements:
256
- - - ">"
256
+ - - ">="
257
257
  - !ruby/object:Gem::Version
258
- version: 1.3.1
258
+ version: '0'
259
259
  requirements: []
260
260
  rubyforge_project:
261
261
  rubygems_version: 2.7.6