beaker-docker 2.2.0 → 2.2.1

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: 841111065b59b77771dab0534b4f9e3f3963378c0a0daf27d86330ab0c733f7a
4
- data.tar.gz: '025243139d8c52cad6a50cd5fa27e6cea07414cdb278aadb395072bd1897448d'
3
+ metadata.gz: 6264189ab77d7c85932a5e565c593365f07450b25d38796e1349c5304754b7cc
4
+ data.tar.gz: fa7f1dcde6a3b11121972a67a91c2c365db17f0ea2e22e36777cef1b07cb88c9
5
5
  SHA512:
6
- metadata.gz: 98afc27265b51cd18868d25651e7003e50f9c26785af54ab277d0e9c673d256aad8a2f4b16905e096c1a2917766b247e44c11d75ae7a7f80e8bd6689174325b4
7
- data.tar.gz: 3d84cef6317f571b79277c17cd3be523184a04fd81aa97bd7e4f3340417aabc19c2a07bbc339c13529e644efbf2b37f099ed1e41e6072d7f00b847e41b3fbb49
6
+ metadata.gz: ff0d8b74a89100b457d1beed90cf9f53e33c93ca891b8c377ee795a06fc261154ee5fd9c88eddc5c68b6517d4129961109e874eac2925ca56907962cd26ad2d6
7
+ data.tar.gz: 4af9b0bd85a33e02c078f743fd9eeeacaed4862e8dfc3f4497713a0dbd630658fb68100a8fdad8d0e7022dfa998f34a57f55c727b0e1b2264fcdb7337ad23109
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.1](https://github.com/voxpupuli/beaker-docker/tree/2.2.1) (2024-03-27)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/2.2.0...2.2.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Fix privileged remote docker port forward resolution [\#126](https://github.com/voxpupuli/beaker-docker/pull/126) ([h0tw1r3](https://github.com/h0tw1r3))
10
+
3
11
  ## [2.2.0](https://github.com/voxpupuli/beaker-docker/tree/2.2.0) (2024-03-17)
4
12
 
5
13
  [Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/2.1.0...2.2.0)
@@ -188,9 +188,9 @@ module Beaker
188
188
  end
189
189
  end
190
190
 
191
- if host_config['NetworkMode'] != 'slirp4netns' && network_settings['IPAddress'] && !network_settings['IPAddress'].empty?
192
- ip = network_settings['IPAddress'] if ip.nil?
193
- else
191
+ ip = network_settings['IPAddress'] if ip.nil? && host_config['NetworkMode'] != 'slirp4netns' && network_settings['IPAddress'] && !network_settings['IPAddress'].empty?
192
+
193
+ if port.nil?
194
194
  port22 = network_settings.dig('Ports', '22/tcp')
195
195
  port = port22[0]['HostPort'] if port22
196
196
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeakerDocker
4
- VERSION = '2.2.0'
4
+ VERSION = '2.2.1'
5
5
  end
@@ -110,6 +110,12 @@ module Beaker
110
110
 
111
111
  before do
112
112
  allow(::Docker).to receive(:rootless?).and_return(true)
113
+ @docker_host = ENV.fetch('DOCKER_HOST', nil)
114
+ ENV.delete('DOCKER_HOST') if @docker_host
115
+ end
116
+
117
+ after do
118
+ ENV['DOCKER_HOST'] = @docker_host if @docker_host
113
119
  end
114
120
 
115
121
  context 'with connection failure' do
@@ -476,64 +482,46 @@ module Beaker
476
482
  end
477
483
 
478
484
  context 'when connecting to ssh' do
479
- context 'when rootless' do
480
- before { @docker_host = ENV.fetch('DOCKER_HOST', nil) }
481
-
482
- after { ENV['DOCKER_HOST'] = @docker_host }
483
-
484
- it 'exposes port 22 to beaker' do
485
- ENV['DOCKER_HOST'] = nil
486
- docker.provision
487
-
488
- expect(hosts[0]['ip']).to eq '127.0.0.1'
489
- expect(hosts[0]['port']).to eq 8022
490
- end
491
-
492
- it 'exposes port 22 to beaker when using DOCKER_HOST' do
493
- ENV['DOCKER_HOST'] = 'tcp://192.0.2.2:2375'
494
- docker.provision
495
-
496
- expect(hosts[0]['ip']).to eq '192.0.2.2'
497
- expect(hosts[0]['port']).to eq 8022
498
- end
485
+ %w[rootless privileged].each do |mode|
486
+ context "when #{mode}" do
487
+ let(:container_mode) do
488
+ mode
489
+ end
499
490
 
500
- it 'has ssh agent forwarding enabled' do
501
- ENV['DOCKER_HOST'] = nil
502
- docker.provision
491
+ it 'exposes port 22 to beaker' do
492
+ docker.provision
503
493
 
504
- expect(hosts[0]['ip']).to eq '127.0.0.1'
505
- expect(hosts[0]['port']).to eq 8022
506
- expect(hosts[0]['ssh'][:password]).to eq 'root'
507
- expect(hosts[0]['ssh'][:port]).to eq 8022
508
- expect(hosts[0]['ssh'][:forward_agent]).to be true
509
- end
494
+ expect(hosts[0]['ip']).to eq '127.0.0.1'
495
+ expect(hosts[0]['port']).to eq 8022
496
+ end
510
497
 
511
- it 'connects to gateway ip' do
512
- FakeFS do
513
- FileUtils.touch('/.dockerenv')
498
+ it 'exposes port 22 to beaker when using DOCKER_HOST' do
499
+ ENV['DOCKER_HOST'] = 'tcp://192.0.2.2:2375'
514
500
  docker.provision
515
501
 
516
- expect(hosts[0]['ip']).to eq '192.0.2.254'
502
+ expect(hosts[0]['ip']).to eq '192.0.2.2'
517
503
  expect(hosts[0]['port']).to eq 8022
518
504
  end
519
- end
520
- end
521
-
522
- context 'when rootful' do
523
- before { @docker_host = ENV.fetch('DOCKER_HOST', nil) }
524
505
 
525
- after { ENV['DOCKER_HOST'] = @docker_host }
506
+ it 'has ssh agent forwarding enabled' do
507
+ docker.provision
526
508
 
527
- let(:container_mode) do
528
- 'rootful'
529
- end
509
+ expect(hosts[0]['ip']).to eq '127.0.0.1'
510
+ expect(hosts[0]['port']).to eq 8022
511
+ expect(hosts[0]['ssh'][:password]).to eq 'root'
512
+ expect(hosts[0]['ssh'][:port]).to eq 8022
513
+ expect(hosts[0]['ssh'][:forward_agent]).to be true
514
+ end
530
515
 
531
- it 'exposes port 22 to beaker' do
532
- ENV['DOCKER_HOST'] = nil
533
- docker.provision
516
+ it 'connects to gateway ip' do
517
+ FakeFS do
518
+ FileUtils.touch('/.dockerenv')
519
+ docker.provision
534
520
 
535
- expect(hosts[0]['ip']).to eq '127.0.0.1'
536
- expect(hosts[0]['port']).to eq 8022
521
+ expect(hosts[0]['ip']).to eq '192.0.2.254'
522
+ expect(hosts[0]['port']).to eq 8022
523
+ end
524
+ end
537
525
  end
538
526
  end
539
527
  end
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: 2.2.0
4
+ version: 2.2.1
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: 2024-03-17 00:00:00.000000000 Z
14
+ date: 2024-03-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fakefs