pdqtest 0.5.1 → 0.6.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 +4 -4
- data/README.md +6 -0
- data/lib/pdqtest/docker.rb +12 -2
- data/lib/pdqtest/rspec.rb +10 -2
- data/lib/pdqtest/util.rb +4 -0
- data/lib/pdqtest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75a6265aa171ae4d88a6e97d754c6018edfe7d3a
|
4
|
+
data.tar.gz: b1ae71344008ff1fdaabf2df6b332c0dc8766c27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '019cde9a45ac72c3f48e1d06779fcdf9d56971215cb434fe2a9cc78dd02a4bb2a699bad97fcb82cdc45e117bd6076975abf222ffa51edc04e5238a600eb3d3df'
|
7
|
+
data.tar.gz: 382c6283d6c0c2801d21634fe3a2709978cd35f7a715fd0d9834bf289b2dfffed77138673162e32f1ae0042335168e5409e25aad79365c937adba584d5b1e3f2
|
data/README.md
CHANGED
@@ -223,6 +223,12 @@ pdqtest generate_acceptance examples/mynewthing.pp
|
|
223
223
|
```
|
224
224
|
* Note: will also create examples/mynewthing.pp if you haven't created it yet
|
225
225
|
|
226
|
+
## Caching
|
227
|
+
PDQTest will attempt to cache:
|
228
|
+
* Puppet modules (via librarian-puppet) in `~/.pdqtest/cache/modules`
|
229
|
+
* The yum cache in `~/.pdqtest/cache/yum`
|
230
|
+
|
231
|
+
Note that since the yum cache is writen to via a docker volume from the container your running tests in, the files in this directory will be root owned. If you need to clear your cache for whatever reason, delete the `~/.pdqtest/cache` directory (you will likely need sudo) and PDQtest will recreate it next time it runs.
|
226
232
|
|
227
233
|
## Development
|
228
234
|
|
data/lib/pdqtest/docker.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pdqtest/util'
|
2
|
+
|
1
3
|
module PDQTest
|
2
4
|
module Docker
|
3
5
|
OUT = 0
|
@@ -8,6 +10,8 @@ module PDQTest
|
|
8
10
|
HIERA_YAML_CONTAINER = '/etc/puppetlabs/puppet/hiera.yaml'
|
9
11
|
HIERA_YAML_HOST = '/spec/fixtures/hiera.yaml'
|
10
12
|
HIERA_DIR = '/spec/fixtures/hieradata'
|
13
|
+
YUM_CACHE_CONTAINER = "/var/cache/yum"
|
14
|
+
YUM_CACHE_HOST = "#{Util::app_dir}/cache/yum"
|
11
15
|
|
12
16
|
def self.wrap_cmd(cmd)
|
13
17
|
['bash', '-c', "#{ENV} #{cmd}"]
|
@@ -33,6 +37,10 @@ module PDQTest
|
|
33
37
|
[]
|
34
38
|
end
|
35
39
|
|
40
|
+
if ! Dir.exists?(YUM_CACHE_HOST)
|
41
|
+
FileUtils.mkdir_p(YUM_CACHE_HOST)
|
42
|
+
end
|
43
|
+
|
36
44
|
# hiera.yaml *must* exist on the host or we will get errors from Docker
|
37
45
|
if ! File.exists?(hiera_yaml_host)
|
38
46
|
File.write(hiera_yaml_host, '# hiera configuration for testing')
|
@@ -41,10 +49,11 @@ module PDQTest
|
|
41
49
|
'Image' => IMAGE_NAME,
|
42
50
|
'Volumes' => {
|
43
51
|
test_dir => {pwd => 'rw'},
|
44
|
-
HIERA_YAML_CONTAINER => {hiera_yaml_host => '
|
45
|
-
HIERA_DIR => {hiera_dir => '
|
52
|
+
HIERA_YAML_CONTAINER => {hiera_yaml_host => 'rw'},
|
53
|
+
HIERA_DIR => {hiera_dir => 'rw'},
|
46
54
|
'/cut' => {pwd => 'rw'}, # DEPRECATED -FOR REMOVAL
|
47
55
|
'/sys/fs/cgroup' => {'/sys/fs/cgroup' => 'ro'},
|
56
|
+
YUM_CACHE_CONTAINER => {YUM_CACHE_HOST => 'rw'},
|
48
57
|
},
|
49
58
|
'HostConfig' => {
|
50
59
|
"SecurityOpt" => security_opt,
|
@@ -54,6 +63,7 @@ module PDQTest
|
|
54
63
|
"#{pwd}:#{test_dir}:rw",
|
55
64
|
"#{hiera_yaml_host}:#{HIERA_YAML_CONTAINER}:rw",
|
56
65
|
"#{hiera_dir}:#{HIERA_DIR}:rw",
|
66
|
+
"#{YUM_CACHE_HOST}:#{YUM_CACHE_CONTAINER}:rw",
|
57
67
|
],
|
58
68
|
},
|
59
69
|
)
|
data/lib/pdqtest/rspec.rb
CHANGED
@@ -4,15 +4,23 @@ require 'pdqtest/util'
|
|
4
4
|
require 'pdqtest/emoji'
|
5
5
|
require 'erb'
|
6
6
|
require 'fileutils'
|
7
|
+
require 'pdqtest/util'
|
8
|
+
|
9
|
+
|
7
10
|
module PDQTest
|
8
11
|
module Rspec
|
9
12
|
SPEC_DIR = './spec'
|
10
13
|
SPEC_CLASSES_DIR = "#{SPEC_DIR}/classes"
|
14
|
+
MODULE_CACHE_DIR = "#{Util::app_dir}/cache/modules"
|
15
|
+
|
11
16
|
|
12
17
|
def self.run
|
13
|
-
|
18
|
+
if ! Dir.exists?(MODULE_CACHE_DIR)
|
19
|
+
FileUtils.mkdir_p(MODULE_CACHE_DIR)
|
20
|
+
end
|
21
|
+
|
14
22
|
PDQTest::Emoji.emoji_message("🐌", "I'm downloading The Internet, please hold...")
|
15
|
-
cmd = "bundle exec librarian-puppet install --path ./spec/fixtures/modules --destructive"
|
23
|
+
cmd = "LIBRARIAN_PUPPET_TMP=#{MODULE_CACHE_DIR} bundle exec librarian-puppet install --path ./spec/fixtures/modules --destructive"
|
16
24
|
status = system(cmd)
|
17
25
|
if status
|
18
26
|
PDQTest::Puppet.git_fixtures.each { |extra_mod_install_cmd|
|
data/lib/pdqtest/util.rb
CHANGED
data/lib/pdqtest/version.rb
CHANGED