beaker-docker 0.8.3 → 0.8.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 334f12192e1c187506529fd753491a8aba885ccf5512d2f681b7b659f4b7f525
4
- data.tar.gz: ee99cc4537be2eb938639fd4078aa1f95eba859b338531ba206c4035587e103a
3
+ metadata.gz: a33de485fa44a24ca53428bc873ee91359d6d872abe4d0794a72e037a189aa4c
4
+ data.tar.gz: 3e58d56f2878a8cfcfea37fb7dbafb10b6ad9a2500b3f1cad069283fb886ddfb
5
5
  SHA512:
6
- metadata.gz: 9df1580cf398c8b43641d9b06e53be3090d2141fd9a9172c1f1a6290f362b5d02819e720ee05046e024c4051a8201001569663feb7716263616f578b0d66fbac
7
- data.tar.gz: 9e1d910176b66e2576cb170f31b80a97491274248a698c89c5925413c35165afc96cd9da9e4ba2acd4fcd1dea548cec5753211ed796ff0e84a91edce9719ce49
6
+ metadata.gz: 95fbe3d0582ce0ff014441f45f38e3c2d174f02c2eb323236a6b77a236327a9392eea43765e05bef87e26d9600be81d84c29ea2170b35d926aa9f1419bb23b77
7
+ data.tar.gz: 67533e7a604103891b076a07ddf54808c360ef18833b3a1a094f1681c1ee69676fbeae8bd5db0b483c7c84e7c643c60e78f3aeaefa16b0893223c7261e590d6b
data/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on
6
+ [Keep a Changelog](http://keepachangelog.com)
7
+ & makes a strong effort to adhere to
8
+ [Semantic Versioning](http://semver.org).
9
+
10
+ Tracking in this Changelog began for this project in version 0.8.4.
11
+ If you're looking for changes from before this, refer to the project's
12
+ git logs & PR history.
13
+
14
+ The headers used in [Keep a Changelog](http://keepachangelog.com) are:
15
+
16
+ - Added - for new features.
17
+ - Changed - for changes in existing functionality.
18
+ - Deprecated - for soon-to-be removed features.
19
+ - Removed - for now removed features.
20
+ - Fixed - for any bug fixes.
21
+ - Security - in case of vulnerabilities.
22
+
23
+ # [0.8.4](https://github.com/voxpupuli/beaker/compare/0.8.3...0.8.4) - 03-15-2021
24
+
25
+ ### Fixed
26
+
27
+ - Use the `docker-api` function `::Docker.rootless?` to see if the container
28
+ ecosystem is running in `rootless` mode. This reduces false positive
29
+ failures across the board.
30
+ - Ensure that the correct port and IP is used for local docker connections
31
+ - Added the `force` option to ensure container removal on error
data/Gemfile.local CHANGED
@@ -1,5 +1,3 @@
1
1
  group :acceptance_testing do
2
- # Needed for podman testing
3
- gem "docker-api", :git => 'https://github.com/trevor-vaughan/docker-api', :branch => 'podman-compat'
4
2
  gem "beaker-rspec"
5
3
  end
data/README.md CHANGED
@@ -117,3 +117,5 @@ Please refer to puppetlabs/beaker's [contributing](https://github.com/puppetlabs
117
117
  ## Releasing
118
118
 
119
119
  To release new versions of beaker-docker, please use update `lib/beaker-docker/version.rb` with the new version number. The version should adhere to [semantic version standards](https://semver.org). When in doubt, ask in the `#voxpupuli` channel of the Puppet community Slack or in `#voxpupuli` on irc.freenode.net ([Webinterface](https://webchat.freenode.net/?channels=%23voxpupuli)).
120
+
121
+ Once the version file has been updated, a contributor can push a new git tag to match and GitHub Actions will do the release to RubyGems.
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
 
33
33
  # Run time dependencies
34
34
  s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
35
- s.add_runtime_dependency 'docker-api', '< 3.0.0'
35
+ s.add_runtime_dependency 'docker-api', '~> 2.1'
36
36
 
37
37
  end
38
38
 
@@ -1,3 +1,3 @@
1
1
  module BeakerDocker
2
- VERSION = '0.8.3'
2
+ VERSION = '0.8.4'
3
3
  end
@@ -152,11 +152,12 @@ module Beaker
152
152
  else
153
153
  port22 = network_settings.dig('Ports','22/tcp')
154
154
  ip = port22[0]["HostIp"] if port22
155
+ port = port22[0]['HostPort'] if port22
155
156
  end
156
157
  end
157
158
 
158
159
  if host_config['NetworkMode'] != 'slirp4netns' && network_settings['IPAddress'] && !network_settings['IPAddress'].empty?
159
- ip = network_settings['IPAddress']
160
+ ip = network_settings['IPAddress'] if ip.nil?
160
161
  else
161
162
  port22 = network_settings.dig('Ports','22/tcp')
162
163
  port = port22[0]['HostPort'] if port22
@@ -259,10 +260,11 @@ module Beaker
259
260
  container = ::Docker::Container.create(container_opts)
260
261
 
261
262
  ssh_info = get_ssh_connection_info(container)
262
- if ssh_info[:ip] == '127.0.0.1' && (ssh_info[:port].to_i < 1024) && (Process.uid != 0)
263
- @logger.debug("#{host} was given a port less than 1024 but you are not running as root, retrying")
263
+ if ::Docker.rootless? && ssh_info[:ip] == '127.0.0.1' && (ssh_info[:port].to_i < 1024)
264
+ @logger.debug("#{host} was given a port less than 1024 but you are connecting to a rootless instance, retrying")
264
265
 
265
- container.delete
266
+ container.delete(force: true)
267
+ container = nil
266
268
 
267
269
  retries+=1
268
270
  next
@@ -287,7 +289,7 @@ module Beaker
287
289
  begin
288
290
  container.stats
289
291
  rescue StandardError => e
290
- container.delete
292
+ container.delete(force: true)
291
293
  raise "Container '#{container.id}' in a bad state: #{e}"
292
294
  end
293
295
 
@@ -402,7 +404,7 @@ module Beaker
402
404
  end
403
405
  @logger.debug("delete container #{container.id}")
404
406
  begin
405
- container.delete
407
+ container.delete(force: true)
406
408
  rescue Excon::Errors::ClientError => e
407
409
  @logger.warn("deletion of container #{container.id} failed: #{e.response.body}")
408
410
  end
@@ -105,6 +105,10 @@ module Beaker
105
105
 
106
106
  let (:version) { {"ApiVersion"=>"1.18", "Arch"=>"amd64", "GitCommit"=>"4749651", "GoVersion"=>"go1.4.2", "KernelVersion"=>"3.16.0-37-generic", "Os"=>"linux", "Version"=>"1.6.0"} }
107
107
 
108
+ before :each do
109
+ allow(::Docker).to receive(:rootless?).and_return(true)
110
+ end
111
+
108
112
  context 'with connection failure' do
109
113
  describe '#initialize' do
110
114
  before :each do
@@ -532,8 +536,8 @@ module Beaker
532
536
  ENV['DOCKER_HOST'] = nil
533
537
  docker.provision
534
538
 
535
- expect( hosts[0]['ip'] ).to be === '192.0.2.1'
536
- expect( hosts[0]['port'] ).to be === '22'
539
+ expect( hosts[0]['ip'] ).to be === '127.0.1.1'
540
+ expect( hosts[0]['port'] ).to be === 8022
537
541
  end
538
542
  end
539
543
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-02-28 00:00:00.000000000 Z
14
+ date: 2021-03-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -115,16 +115,16 @@ dependencies:
115
115
  name: docker-api
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - "<"
118
+ - - "~>"
119
119
  - !ruby/object:Gem::Version
120
- version: 3.0.0
120
+ version: '2.1'
121
121
  type: :runtime
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "<"
125
+ - - "~>"
126
126
  - !ruby/object:Gem::Version
127
- version: 3.0.0
127
+ version: '2.1'
128
128
  description: For use for the Beaker acceptance testing tool
129
129
  email:
130
130
  - voxpupuli@groups.io
@@ -138,6 +138,7 @@ files:
138
138
  - ".github/workflows/test.yml"
139
139
  - ".gitignore"
140
140
  - ".simplecov"
141
+ - CHANGELOG.md
141
142
  - Gemfile
142
143
  - Gemfile.local
143
144
  - LICENSE