pdqtest 1.0.1 → 1.1.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/doc/acceptance_tests.md +5 -0
- data/exe/pdqtest +9 -0
- data/lib/pdqtest/docker.rb +2 -1
- data/lib/pdqtest/instance.rb +11 -2
- data/lib/pdqtest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b31dcb07b28f856c67946e787ae6c7f738a80cd35094dca5e40945b5d583cb93
|
4
|
+
data.tar.gz: 8414386c5b910112ed305524e81fa333bca8f0b7c7def8a1af773d259460b921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 925cf675abe919ae5b63a95be161b27e9d087011480cae06c094b1c07a435a7e59af7e9bc5644255449c9657dc78cdb40bab19c25d935027d5355aa7e0914b5d
|
7
|
+
data.tar.gz: 51dfde1ed0ffb94309f95c43cf9152f80f534fd7ac6ac600e3d0869ed65d28d5683642373307963a89a6a365d87a636970e6a4033662d3ca5f3c25a9bee8c1ce
|
data/doc/acceptance_tests.md
CHANGED
@@ -91,3 +91,8 @@ pdqtest --keep-container all
|
|
91
91
|
* Keeps the container Running
|
92
92
|
* After testing, the container used to run tests will be left running and a message will be printed showing how to enter the container used for testing. Your code is avaiable at `/testcase`
|
93
93
|
* User is responsible for cleaning up the containers created in this mode
|
94
|
+
|
95
|
+
### Docker privileged mode
|
96
|
+
Sometimes you need to run in Docker privileged mode to enable tests to work - not ideal and if anyone else has a better idea please open a ticket with the details. When privileged mode is required, run `pdqtest --privileged` and you will have access.
|
97
|
+
|
98
|
+
WARNING: This grants the container access to the host
|
data/exe/pdqtest
CHANGED
@@ -57,6 +57,13 @@ Escort::App.create do |app|
|
|
57
57
|
:default => false,
|
58
58
|
)
|
59
59
|
|
60
|
+
opts.opt(:privileged,
|
61
|
+
'Run docker containers in privileged mode',
|
62
|
+
:long => '--privileged',
|
63
|
+
:type => :boolean,
|
64
|
+
:default => false,
|
65
|
+
)
|
66
|
+
|
60
67
|
end
|
61
68
|
|
62
69
|
app.command :all do |command|
|
@@ -66,6 +73,7 @@ Escort::App.create do |app|
|
|
66
73
|
PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
|
67
74
|
PDQTest::Puppet.skip_second_run(options[:global][:options][:skip_idempotency])
|
68
75
|
|
76
|
+
PDQTest::Instance.set_privileged(options[:global][:options][:privileged])
|
69
77
|
PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
|
70
78
|
PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
|
71
79
|
|
@@ -102,6 +110,7 @@ Escort::App.create do |app|
|
|
102
110
|
command.action do |options, arguments|
|
103
111
|
PDQTest::Emoji.disable(options[:global][:options][:disable_emoji])
|
104
112
|
PDQTest::Puppet.skip_second_run(options[:global][:options][:skip_idempotency])
|
113
|
+
PDQTest::Instance.set_privileged(options[:global][:options][:privileged])
|
105
114
|
PDQTest::Instance.set_docker_image(options[:global][:options][:image_name])
|
106
115
|
PDQTest::Instance.set_keep_container(options[:global][:options][:keep_container])
|
107
116
|
example = options[:global][:commands][:acceptance][:options][:example]
|
data/lib/pdqtest/docker.rb
CHANGED
@@ -60,7 +60,7 @@ module PDQTest
|
|
60
60
|
supported_images.uniq
|
61
61
|
end
|
62
62
|
|
63
|
-
def self.new_container(test_dir, image_name)
|
63
|
+
def self.new_container(test_dir, image_name, privileged)
|
64
64
|
pwd = Dir.pwd
|
65
65
|
hiera_yaml_host = File.join(pwd, HIERA_YAML_HOST)
|
66
66
|
hiera_dir = File.join(pwd, HIERA_DIR)
|
@@ -113,6 +113,7 @@ module PDQTest
|
|
113
113
|
'/run/lock' => '',
|
114
114
|
},
|
115
115
|
CapAdd: [ 'SYS_ADMIN'],
|
116
|
+
Privileged: privileged,
|
116
117
|
},
|
117
118
|
}
|
118
119
|
)
|
data/lib/pdqtest/instance.rb
CHANGED
@@ -9,6 +9,7 @@ module PDQTest
|
|
9
9
|
@@keep_container = false
|
10
10
|
@@active_container = nil
|
11
11
|
@@image_name = false
|
12
|
+
@@privileged = false
|
12
13
|
|
13
14
|
def self.get_active_container
|
14
15
|
@@active_container
|
@@ -31,6 +32,14 @@ module PDQTest
|
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
35
|
+
def self.set_privileged(privileged)
|
36
|
+
@@privileged = privileged
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.get_privileged
|
40
|
+
@@privileged
|
41
|
+
end
|
42
|
+
|
34
43
|
def self.run(example=nil)
|
35
44
|
# needed to prevent timeouts from container.exec()
|
36
45
|
Excon.defaults[:write_timeout] = 10000
|
@@ -48,7 +57,7 @@ module PDQTest
|
|
48
57
|
Escort::Logger.output.puts "Acceptance test on #{test_platforms}..."
|
49
58
|
test_platforms.each { |image_name|
|
50
59
|
Escort::Logger.output.puts "--- start test with #{image_name} ---"
|
51
|
-
@@active_container = PDQTest::Docker::new_container(TEST_DIR, image_name)
|
60
|
+
@@active_container = PDQTest::Docker::new_container(TEST_DIR, image_name, @@privileged)
|
52
61
|
Escort::Logger.output.puts "alive, running tests"
|
53
62
|
status &= PDQTest::Puppet.run(@@active_container, example)
|
54
63
|
|
@@ -72,7 +81,7 @@ module PDQTest
|
|
72
81
|
# just list it with --image-name
|
73
82
|
image_name = (@@image_name || Docker::acceptance_test_images).first
|
74
83
|
Escort::Logger.output.puts "Opening a shell in #{image_name}"
|
75
|
-
@@active_container = PDQTest::Docker::new_container(TEST_DIR, image_name)
|
84
|
+
@@active_container = PDQTest::Docker::new_container(TEST_DIR, image_name, @@privileged)
|
76
85
|
|
77
86
|
# In theory I should be able to get something like the code below to
|
78
87
|
# redirect all input streams and give a makeshift interactive shell, howeve
|
data/lib/pdqtest/version.rb
CHANGED
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.0
|
4
|
+
version: 1.1.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: 2018-04-
|
11
|
+
date: 2018-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|