pdqtest 1.0.1 → 1.1.0

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: 7b17488530a2a8adcfe4c2a923d10613515bf5d7447078c97587a3c0c907e011
4
- data.tar.gz: e1a9553a36e8be6bcc51d34dd6c4ceb9b9473be2088229b36ea68c3962c73f52
3
+ metadata.gz: b31dcb07b28f856c67946e787ae6c7f738a80cd35094dca5e40945b5d583cb93
4
+ data.tar.gz: 8414386c5b910112ed305524e81fa333bca8f0b7c7def8a1af773d259460b921
5
5
  SHA512:
6
- metadata.gz: b02cf93cedb23d5b1a47aa257e09328e89e6a157dd61eabafe8829462300725e6caea517fc7a6be7e6ffc5724ca867b37ed64428749dfc4c6dd721fb786eb968
7
- data.tar.gz: 3045966e2fec1c532ad4e5451f1fea9968c1fa50de10eb2d169fffb49bb958cc50a1c6e3d5f5aba7894a3595557f96e978d5dc676444c369ba62a1b543482669
6
+ metadata.gz: 925cf675abe919ae5b63a95be161b27e9d087011480cae06c094b1c07a435a7e59af7e9bc5644255449c9657dc78cdb40bab19c25d935027d5355aa7e0914b5d
7
+ data.tar.gz: 51dfde1ed0ffb94309f95c43cf9152f80f534fd7ac6ac600e3d0869ed65d28d5683642373307963a89a6a365d87a636970e6a4033662d3ca5f3c25a9bee8c1ce
@@ -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]
@@ -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
  )
@@ -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
@@ -1,4 +1,4 @@
1
1
  module PDQTest
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  PUPPET_VERSION = "5.3.5"
4
4
  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: 1.0.1
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-14 00:00:00.000000000 Z
11
+ date: 2018-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler