Skip to content

Commit

Permalink
set flack for container_2_container
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaffen committed Mar 3, 2023
1 parent 2285a57 commit 9b13597
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ jobs:
- name: Run acceptance tests
run: bundle exec rake test:acceptance

beaker_in_container:
runs-on: ubuntu-latest
name: Docker - Beaker in container connection test
steps:
- uses: actions/checkout@v3
# use this and not container key from gha to not have a docker network from github
- name: Run Beaker in docker container
uses: addnab/docker-run-action@v3
with:
image: puppet/puppet-dev-tools:2023-02-24-1bca42e
options: -v ${{ github.workspace }}:/work
run: |
cd /work
ls -la
bundle install
export DOCKER_IN_DOCKER=true
bundle exec rake test:acceptance
podman:
runs-on: ubuntu-latest
strategy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ doc
# Vagrant folder
.vagrant/
.vagrant_files/
vendor/bundle
11 changes: 2 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-12-21 18:24:52 UTC using RuboCop version 1.12.1.
# on 2023-03-03 13:24:13 UTC using RuboCop version 1.12.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -541,13 +541,6 @@ Style/GuardClause:
Exclude:
- 'lib/beaker/hypervisor/docker.rb'

# Offense count: 39
# Cop supports --auto-correct.
# Configuration parameters: UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
EnforcedStyle: hash_rockets

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowIfModifier.
Expand Down Expand Up @@ -690,7 +683,7 @@ Style/StringConcatenation:
- 'lib/beaker/hypervisor/docker.rb'
- 'spec/spec_helper.rb'

# Offense count: 66
# Offense count: 64
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ A quick acceptance test, named because it has no pre-suites to run
beaker_test_base_dir = File.join(beaker_gem_dir, 'acceptance/tests/base')
load_path_option = File.join(beaker_gem_dir, 'acceptance/lib')

ENV['BEAKER_setfile'] = 'acceptance/config/nodes/hosts.yaml'
ENV['BEAKER_setfile'] = 'acceptance/config/nodes/hosts.yaml' unless ENV.key?('BEAKER_setfile')
sh("beaker",
"--hosts", "acceptance/config/nodes/hosts.yaml",
# We can't run these tests until the rsync support in the main
# beaker/host.rb is updated to work with passwords.
# "--tests", beaker_test_base_dir,
Expand Down
7 changes: 4 additions & 3 deletions lib/beaker/hypervisor/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def get_ssh_connection_info(container)
port: nil
}

container_json = container.json
container_json = container.json
network_settings = container_json['NetworkSettings']
host_config = container_json['HostConfig']
host_config = container_json['HostConfig']

ip = nil
port = nil
Expand All @@ -161,9 +161,10 @@ def get_ssh_connection_info(container)

# Host to Container
port22 = network_settings.dig('PortBindings','22/tcp')
if port22.nil? && network_settings.key?('Ports')
if port22.nil? && network_settings.key?('Ports') && !nested_docker?
port22 = network_settings.dig('Ports','22/tcp')
end

ip = port22[0]['HostIp'] if port22
port = port22[0]['HostPort'] if port22

Expand Down

0 comments on commit 9b13597

Please sign in to comment.