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 +4 -4
- data/doc/installation.md +5 -3
- data/doc/pdk.md +6 -0
- data/doc/running_tests.md +2 -0
- data/docker_images/ubuntu/Dockerfile +14 -1
- data/lib/pdqtest/docker.rb +1 -1
- data/lib/pdqtest/inplace.rb +6 -10
- data/lib/pdqtest/instance.rb +1 -1
- data/lib/pdqtest/pdk.rb +2 -29
- data/lib/pdqtest/skeleton.rb +1 -0
- data/lib/pdqtest/upgrade.rb +5 -5
- data/lib/pdqtest/util.rb +40 -2
- data/lib/pdqtest/version.rb +1 -1
- data/res/skeleton/bitbucket-pipelines.yml +13 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c613051273e1726c3eba61ccf83240240071febd92f389a3fc5deb9e450d731c
|
4
|
+
data.tar.gz: 653aed1411b01865e5dd0f4c496d83c9bb9154433685d2f8e4bf2d2de172f670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
30
|
-
|
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
|
-
|
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
@@ -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:/
|
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
|
data/lib/pdqtest/docker.rb
CHANGED
@@ -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-
|
13
|
+
:UBUNTU => 'declarativesystems/pdqtest-ubuntu:2018-10-06-0',
|
14
14
|
:WINDOWS => 'declarativesystems/pdqtest-windows:2018-09-30-0',
|
15
15
|
}
|
16
16
|
|
data/lib/pdqtest/inplace.rb
CHANGED
@@ -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
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
data/lib/pdqtest/instance.rb
CHANGED
data/lib/pdqtest/pdk.rb
CHANGED
@@ -33,35 +33,8 @@ module PDQTest
|
|
33
33
|
PDQTest::Puppet.fixtures_yml
|
34
34
|
end
|
35
35
|
|
36
|
-
#
|
37
|
-
|
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
|
data/lib/pdqtest/skeleton.rb
CHANGED
@@ -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
|
|
data/lib/pdqtest/upgrade.rb
CHANGED
@@ -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
|
-
|
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", "#{
|
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
|
data/lib/pdqtest/version.rb
CHANGED
@@ -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:
|
5
|
+
image: declarativesystems/pdqtest-ubuntu:2018-10-06-0
|
6
6
|
|
7
7
|
pipelines:
|
8
8
|
default:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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:
|
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-
|
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:
|
258
|
+
version: '0'
|
259
259
|
requirements: []
|
260
260
|
rubyforge_project:
|
261
261
|
rubygems_version: 2.7.6
|