docker-spec 0.27.0 → 0.28.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: a11bce9c1425052b9bb9640e04b72597835737e05cc2b3c715b00268fc4f0a1d
4
- data.tar.gz: 43487f947eb9995e4cb2103ce1b951e706f41fef086132830ce50e54e9ab854d
3
+ metadata.gz: 75697767f272ef06062ff56c5bcd6852d1757432e4032994391b12062f458bfb
4
+ data.tar.gz: 04b49534e16705dc7b048283d068cebd20361f7634d3a856c24479fafa770eee
5
5
  SHA512:
6
- metadata.gz: bc236841dff09e431893f46821227bb2bda53c9d2c87c6266aa02865006b22ed91d9f79b4c3f273b11479aa9f6882a8091b6e1416e54beac36519a9bf2154ae7
7
- data.tar.gz: 2826b779580e4b441910b89e67110788f84950485129d4061f5039e124105c1c1412bebb1a9c0e47b33f0b672ad4039be19bbc2aec4676dcab905a194f2946de
6
+ metadata.gz: '0058f20c0fdd4b97b2e03ccf4f6480a2b15e9ceafdadd2f8fd51850314124129ed2a10248217ff0d78a33cf53c0a810c5666c0f1b066d69f4fa0043c34821ca8'
7
+ data.tar.gz: 1114eba009d8766abfe88efa649a815772d9b33f0723102b77f85ce8fa2ca4b318a04d96660bb40a0d5b7d0150e71c74efee48ec9f13598f680eacf72b91b9d2
@@ -48,8 +48,6 @@ class DockerSpec
48
48
  end
49
49
 
50
50
  def push
51
- @config[:push_container] = get_config(:push_container, 'DOCKER_SPEC_PUSH_CONTAINER',
52
- 'Push new tag? ')
53
51
  if @config[:push_container]
54
52
 
55
53
  @config[:tag_db] ||
@@ -123,6 +121,11 @@ class DockerSpec
123
121
  'Clear docker cache? ') if @config[:build_image]
124
122
  @config[:tag_db] = get_config(:tag_db, 'DOCKER_SPEC_TAG_DB', 'tag db?')
125
123
  @config[:tag_prefix] = get_config(:tag_prefix, 'DOCKER_SPEC_TAG_PREFIX', 'tag prefix?', '')
124
+ @config[:standard_tests] = get_config(:standard_tests, 'DOCKER_SPEC_STANDARD_TESTS', '', true)
125
+ @config[:keep_running] = get_config(:keep_running, 'DOCKER_SPEC_KEEP_RUNNING',
126
+ "\nKeep container running? ")
127
+ @config[:push_container] = get_config(:push_container, 'DOCKER_SPEC_PUSH_CONTAINER',
128
+ 'Push new tag? ')
126
129
  @config
127
130
  end
128
131
 
@@ -167,6 +170,7 @@ EOF
167
170
 
168
171
  def rspec_configure
169
172
  set :backend, :docker
173
+ $docker_spec_config = @config
170
174
 
171
175
  RSpec.configure do |rc|
172
176
  rc.fail_fast = true
@@ -195,13 +199,15 @@ EOF
195
199
 
196
200
  opts['env'] = @config[:env] unless @config[:env].nil?
197
201
  opts['Image'] = @config[:image_name]
202
+
198
203
  @container = Docker::Container.create(opts).start
204
+
199
205
  Timeout::timeout(10) do
200
206
  loop do
201
207
  @container.refresh!
202
208
  break if @container.info["State"]["Running"]
203
209
  end
204
- end
210
+ end if @config[:standard_tests]
205
211
 
206
212
 
207
213
  # Check the logs, when it stops logging we can assume the container
@@ -212,7 +218,8 @@ EOF
212
218
  break if log_size_ary.last(3).sort.uniq.size == 1 &&
213
219
  log_size_ary.last(3).sort.uniq.last > 0
214
220
  sleep 1
215
- end
221
+ end if @config[:standard_tests]
222
+
216
223
  set :docker_container, @container.id
217
224
  end
218
225
 
@@ -223,9 +230,7 @@ EOF
223
230
 
224
231
  def clean_up
225
232
  # Keep container running
226
- @config[:keep_running] = get_config(:keep_running, 'DOCKER_SPEC_KEEP_RUNNING',
227
- "\nKeep container running? ")
228
- if @config[:keep_running]
233
+ if @config[:keep_running] && @config[:standard_tests]
229
234
  puts "\nINFO: To connect to a running container: \n\n" \
230
235
  "docker exec -ti #{@container.info["Name"][1..-1]} bash"
231
236
  else
@@ -1,6 +1,8 @@
1
1
  module Docker
2
2
  module Spec
3
3
  def self.docker_tests
4
+ @config = DockerSpec.instance.config
5
+
4
6
  describe 'Running a docker container', test: :default do
5
7
  before(:all) do
6
8
  @container = DockerSpec.instance.container
@@ -31,7 +33,7 @@ module Docker
31
33
  end
32
34
  expect(@container.logs(stdout: true)).to_not match(/exit/)
33
35
  end
34
- end
36
+ end if @config[:standard_tests]
35
37
  end
36
38
  end
37
39
  end
@@ -1,5 +1,5 @@
1
1
  module Docker
2
2
  module Spec
3
- VERSION = "0.27.0"
3
+ VERSION = "0.28.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-15 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler