beaker-docker 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/.github/workflows/test.yml +30 -60
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -25
- data/.rubocop_todo.yml +9 -706
- data/.simplecov +2 -0
- data/CHANGELOG.md +51 -1
- data/Gemfile +3 -5
- data/Rakefile +37 -137
- data/acceptance/tests/00_default_spec.rb +5 -4
- data/beaker-docker.gemspec +21 -20
- data/bin/beaker-docker +8 -10
- data/lib/beaker/hypervisor/docker.rb +190 -217
- data/lib/beaker-docker/version.rb +3 -1
- data/lib/beaker-docker.rb +1 -0
- data/spec/beaker/hypervisor/docker_spec.rb +371 -389
- data/spec/spec_helper.rb +6 -5
- metadata +34 -38
- data/Gemfile.local +0 -3
data/.simplecov
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,56 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [2.0.0](https://github.com/voxpupuli/beaker-docker/tree/2.0.0) (2023-03-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.5.0...2.0.0)
|
6
|
+
|
7
|
+
**Breaking changes:**
|
8
|
+
|
9
|
+
- Drop Ruby 2.4/2.5/2.6 support [\#109](https://github.com/voxpupuli/beaker-docker/pull/109) ([bastelfreak](https://github.com/bastelfreak))
|
10
|
+
|
11
|
+
**Implemented enhancements:**
|
12
|
+
|
13
|
+
- Drop `beaker-rspec` dependency [\#107](https://github.com/voxpupuli/beaker-docker/pull/107) ([jay7x](https://github.com/jay7x))
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Rubocop: fix more violations [\#113](https://github.com/voxpupuli/beaker-docker/pull/113) ([bastelfreak](https://github.com/bastelfreak))
|
18
|
+
- rubocop: Use shared config from beaker [\#112](https://github.com/voxpupuli/beaker-docker/pull/112) ([bastelfreak](https://github.com/bastelfreak))
|
19
|
+
- Fix even more rubocop issues [\#111](https://github.com/voxpupuli/beaker-docker/pull/111) ([jay7x](https://github.com/jay7x))
|
20
|
+
- More rubocop fixes [\#110](https://github.com/voxpupuli/beaker-docker/pull/110) ([jay7x](https://github.com/jay7x))
|
21
|
+
- Fix more rubocop warnings [\#108](https://github.com/voxpupuli/beaker-docker/pull/108) ([jay7x](https://github.com/jay7x))
|
22
|
+
- Fix multiple Rubocop warnings [\#106](https://github.com/voxpupuli/beaker-docker/pull/106) ([bastelfreak](https://github.com/bastelfreak))
|
23
|
+
|
24
|
+
## [1.5.0](https://github.com/voxpupuli/beaker-docker/tree/1.5.0) (2023-03-24)
|
25
|
+
|
26
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.4.0...1.5.0)
|
27
|
+
|
28
|
+
**Implemented enhancements:**
|
29
|
+
|
30
|
+
- Ruby 3.2 compatibility [\#100](https://github.com/voxpupuli/beaker-docker/pull/100) ([ekohl](https://github.com/ekohl))
|
31
|
+
- Set required Ruby version to 2.4+ [\#99](https://github.com/voxpupuli/beaker-docker/pull/99) ([ekohl](https://github.com/ekohl))
|
32
|
+
- Simplify port detection code [\#95](https://github.com/voxpupuli/beaker-docker/pull/95) ([ekohl](https://github.com/ekohl))
|
33
|
+
- Add Ruby 3.1 to CI matrix [\#87](https://github.com/voxpupuli/beaker-docker/pull/87) ([bastelfreak](https://github.com/bastelfreak))
|
34
|
+
- Use ssh-keygen -A on Red Hat-based distros & SuSE/SLES [\#73](https://github.com/voxpupuli/beaker-docker/pull/73) ([ekohl](https://github.com/ekohl))
|
35
|
+
|
36
|
+
**Fixed bugs:**
|
37
|
+
|
38
|
+
- Deal with docker\_cmd being an array and remove use of =~ [\#93](https://github.com/voxpupuli/beaker-docker/pull/93) ([ekohl](https://github.com/ekohl))
|
39
|
+
|
40
|
+
**Merged pull requests:**
|
41
|
+
|
42
|
+
- Remove Gemfile.local from git [\#104](https://github.com/voxpupuli/beaker-docker/pull/104) ([ekohl](https://github.com/ekohl))
|
43
|
+
- Fix rubocop Naming/FileName [\#103](https://github.com/voxpupuli/beaker-docker/pull/103) ([jay7x](https://github.com/jay7x))
|
44
|
+
- cleanup GitHub actions [\#102](https://github.com/voxpupuli/beaker-docker/pull/102) ([bastelfreak](https://github.com/bastelfreak))
|
45
|
+
- Remove unused rspec-its dependency [\#98](https://github.com/voxpupuli/beaker-docker/pull/98) ([ekohl](https://github.com/ekohl))
|
46
|
+
- Allow fakefs 2.x [\#97](https://github.com/voxpupuli/beaker-docker/pull/97) ([ekohl](https://github.com/ekohl))
|
47
|
+
- Remove yard rake tasks [\#96](https://github.com/voxpupuli/beaker-docker/pull/96) ([ekohl](https://github.com/ekohl))
|
48
|
+
- rubocop: fix dependency ordering [\#94](https://github.com/voxpupuli/beaker-docker/pull/94) ([bastelfreak](https://github.com/bastelfreak))
|
49
|
+
- GHA: Use builtin podman [\#86](https://github.com/voxpupuli/beaker-docker/pull/86) ([bastelfreak](https://github.com/bastelfreak))
|
50
|
+
- GHA: Use builtin docker [\#85](https://github.com/voxpupuli/beaker-docker/pull/85) ([bastelfreak](https://github.com/bastelfreak))
|
51
|
+
- Fix rubocop-related issues \(part 1\) [\#75](https://github.com/voxpupuli/beaker-docker/pull/75) ([jay7x](https://github.com/jay7x))
|
52
|
+
|
53
|
+
## [1.4.0](https://github.com/voxpupuli/beaker-docker/tree/1.4.0) (2023-03-10)
|
4
54
|
|
5
55
|
[Full Changelog](https://github.com/voxpupuli/beaker-docker/compare/1.3.0...1.4.0)
|
6
56
|
|
data/Gemfile
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
|
-
if File.exists? "#{__FILE__}.local"
|
6
|
-
eval(File.read("#{__FILE__}.local"), binding)
|
7
|
-
end
|
8
|
-
|
9
7
|
group :coverage, optional: ENV['COVERAGE'] != 'yes' do
|
10
|
-
gem 'simplecov-console', require: false
|
11
8
|
gem 'codecov', require: false
|
9
|
+
gem 'simplecov-console', require: false
|
12
10
|
end
|
13
11
|
|
14
12
|
group :release do
|
data/Rakefile
CHANGED
@@ -1,24 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rspec/core/rake_task'
|
2
4
|
|
3
|
-
|
5
|
+
begin
|
4
6
|
require 'rubocop/rake_task'
|
7
|
+
rescue LoadError
|
8
|
+
# RuboCop is an optional group
|
9
|
+
else
|
5
10
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
# These make the rubocop experience maybe slightly less terrible
|
12
|
+
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
|
13
|
+
# Use Rubocop's Github Actions formatter if possible
|
14
|
+
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
|
10
15
|
end
|
11
16
|
end
|
12
17
|
|
13
18
|
namespace :test do
|
14
19
|
namespace :spec do
|
15
|
-
desc
|
20
|
+
desc 'Run spec tests'
|
16
21
|
RSpec::Core::RakeTask.new(:run) do |t|
|
17
22
|
t.rspec_opts = ['--color', '--format documentation']
|
18
23
|
t.pattern = 'spec/'
|
19
24
|
end
|
20
25
|
|
21
|
-
desc
|
26
|
+
desc 'Run spec tests with coverage'
|
22
27
|
RSpec::Core::RakeTask.new(:coverage) do |t|
|
23
28
|
ENV['BEAKER_DOCKER_COVERAGE'] = 'y'
|
24
29
|
t.rspec_opts = ['--color', '--format documentation']
|
@@ -27,26 +32,25 @@ namespace :test do
|
|
27
32
|
end
|
28
33
|
|
29
34
|
namespace :acceptance do
|
30
|
-
desc
|
31
|
-
A quick acceptance test, named because it has no pre-suites to run
|
32
|
-
EOS
|
35
|
+
desc 'A quick acceptance test, named because it has no pre-suites to run'
|
33
36
|
task :quick do
|
34
|
-
|
35
|
-
|
36
|
-
beaker_gem_spec = Gem::Specification.find_by_name('beaker')
|
37
|
-
beaker_gem_dir = beaker_gem_spec.gem_dir
|
38
|
-
beaker_test_base_dir = File.join(beaker_gem_dir, 'acceptance/tests/base')
|
39
|
-
load_path_option = File.join(beaker_gem_dir, 'acceptance/lib')
|
40
|
-
|
41
|
-
ENV['BEAKER_setfile'] = 'acceptance/config/nodes/hosts.yaml'
|
42
|
-
sh(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
37
|
+
## setup & load_path of beaker's acceptance base and lib directory
|
38
|
+
## see below for the reason why it's commented out atm
|
39
|
+
# beaker_gem_spec = Gem::Specification.find_by_name('beaker')
|
40
|
+
# beaker_gem_dir = beaker_gem_spec.gem_dir
|
41
|
+
# beaker_test_base_dir = File.join(beaker_gem_dir, 'acceptance/tests/base')
|
42
|
+
# load_path_option = File.join(beaker_gem_dir, 'acceptance/lib')
|
43
|
+
|
44
|
+
ENV['BEAKER_setfile'] = 'acceptance/config/nodes/hosts.yaml'
|
45
|
+
sh('beaker',
|
46
|
+
'--hosts', 'acceptance/config/nodes/hosts.yaml',
|
47
|
+
## We can't run these tests until the rsync support in the main
|
48
|
+
## beaker/host.rb is updated to work with passwords.
|
49
|
+
# '--tests', beaker_test_base_dir,
|
50
|
+
# '--load-path', load_path_option,
|
51
|
+
'--tests', 'acceptance/tests/',
|
52
|
+
'--log-level', 'debug',
|
53
|
+
'--debug')
|
50
54
|
end
|
51
55
|
end
|
52
56
|
end
|
@@ -54,126 +58,22 @@ end
|
|
54
58
|
# namespace-named default tasks.
|
55
59
|
# these are the default tasks invoked when only the namespace is referenced.
|
56
60
|
# they're needed because `task :default` in those blocks doesn't work as expected.
|
57
|
-
task 'test:spec'
|
58
|
-
task 'test:acceptance'
|
61
|
+
task 'test:spec': %i[test:spec:run]
|
62
|
+
task 'test:acceptance': %i[test:acceptance:quick]
|
59
63
|
|
60
64
|
# global defaults
|
61
|
-
task :
|
62
|
-
task :
|
63
|
-
task :
|
64
|
-
|
65
|
-
###########################################################
|
66
|
-
#
|
67
|
-
# Documentation Tasks
|
68
|
-
#
|
69
|
-
###########################################################
|
70
|
-
DOCS_DAEMON = "yard server --reload --daemon --server thin"
|
71
|
-
FOREGROUND_SERVER = 'bundle exec yard server --reload --verbose --server thin lib/beaker'
|
72
|
-
|
73
|
-
def running?( cmdline )
|
74
|
-
ps = `ps -ef`
|
75
|
-
found = ps.lines.grep( /#{Regexp.quote( cmdline )}/ )
|
76
|
-
if found.length > 1
|
77
|
-
raise StandardError, "Found multiple YARD Servers. Don't know what to do."
|
78
|
-
end
|
79
|
-
|
80
|
-
yes = found.empty? ? false : true
|
81
|
-
return yes, found.first
|
82
|
-
end
|
83
|
-
|
84
|
-
def pid_from( output )
|
85
|
-
output.squeeze(' ').strip.split(' ')[1]
|
86
|
-
end
|
87
|
-
|
88
|
-
desc 'Start the documentation server in the foreground'
|
89
|
-
task :docs => 'docs:clear' do
|
90
|
-
original_dir = Dir.pwd
|
91
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
92
|
-
sh FOREGROUND_SERVER
|
93
|
-
Dir.chdir( original_dir )
|
94
|
-
end
|
95
|
-
|
96
|
-
namespace :docs do
|
97
|
-
desc 'Clear the generated documentation cache'
|
98
|
-
task :clear do
|
99
|
-
original_dir = Dir.pwd
|
100
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
101
|
-
sh 'rm -rf docs'
|
102
|
-
Dir.chdir( original_dir )
|
103
|
-
end
|
104
|
-
|
105
|
-
desc 'Generate static documentation'
|
106
|
-
task :gen => 'docs:clear' do
|
107
|
-
original_dir = Dir.pwd
|
108
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
109
|
-
output = `bundle exec yard doc`
|
110
|
-
puts output
|
111
|
-
if output =~ /\[warn\]|\[error\]/
|
112
|
-
fail "Errors/Warnings during yard documentation generation"
|
113
|
-
end
|
114
|
-
Dir.chdir( original_dir )
|
115
|
-
end
|
116
|
-
|
117
|
-
desc 'Run the documentation server in the background, alias `bg`'
|
118
|
-
task :background => 'docs:clear' do
|
119
|
-
yes, output = running?( DOCS_DAEMON )
|
120
|
-
if yes
|
121
|
-
puts "Not starting a new YARD Server..."
|
122
|
-
puts "Found one running with pid #{pid_from( output )}."
|
123
|
-
else
|
124
|
-
original_dir = Dir.pwd
|
125
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
126
|
-
sh "bundle exec #{DOCS_DAEMON}"
|
127
|
-
Dir.chdir( original_dir )
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
task(:bg) { Rake::Task['docs:background'].invoke }
|
132
|
-
|
133
|
-
desc 'Check the status of the documentation server'
|
134
|
-
task :status do
|
135
|
-
yes, output = running?( DOCS_DAEMON )
|
136
|
-
if yes
|
137
|
-
pid = pid_from( output )
|
138
|
-
puts "Found a YARD Server running with pid #{pid}"
|
139
|
-
else
|
140
|
-
puts "Could not find a running YARD Server."
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
desc "Stop a running YARD Server"
|
145
|
-
task :stop do
|
146
|
-
yes, output = running?( DOCS_DAEMON )
|
147
|
-
if yes
|
148
|
-
pid = pid_from( output )
|
149
|
-
puts "Found a YARD Server running with pid #{pid}"
|
150
|
-
`kill #{pid}`
|
151
|
-
puts "Stopping..."
|
152
|
-
yes, output = running?( DOCS_DAEMON )
|
153
|
-
if yes
|
154
|
-
`kill -9 #{pid}`
|
155
|
-
yes, output = running?( DOCS_DAEMON )
|
156
|
-
if yes
|
157
|
-
puts "Could not Stop Server!"
|
158
|
-
else
|
159
|
-
puts "Server stopped."
|
160
|
-
end
|
161
|
-
else
|
162
|
-
puts "Server stopped."
|
163
|
-
end
|
164
|
-
else
|
165
|
-
puts "Could not find a running YARD Server"
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
65
|
+
task lint: %i[lint:rubocop]
|
66
|
+
task test: %i[test:spec]
|
67
|
+
task default: %i[test]
|
169
68
|
|
170
69
|
begin
|
171
70
|
require 'rubygems'
|
172
71
|
require 'github_changelog_generator/task'
|
173
72
|
rescue LoadError
|
73
|
+
# Do nothing if no required gem installed
|
174
74
|
else
|
175
75
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
176
|
-
config.exclude_labels = %w
|
76
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
|
177
77
|
config.user = 'voxpupuli'
|
178
78
|
config.project = 'beaker-docker'
|
179
79
|
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'beaker'
|
2
|
-
require 'beaker-rspec'
|
3
4
|
|
4
|
-
|
5
|
+
test_name 'Ensure docker container is accessible' do
|
5
6
|
hosts.each do |host|
|
6
|
-
|
7
|
-
on(host, '
|
7
|
+
step "on #{host}" do
|
8
|
+
on(host, 'true')
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
data/beaker-docker.gemspec
CHANGED
@@ -1,39 +1,40 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
3
4
|
require 'beaker-docker/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
7
|
+
s.name = 'beaker-docker'
|
7
8
|
s.version = BeakerDocker::VERSION
|
8
9
|
s.authors = [
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
'Vox Pupuli',
|
11
|
+
'Rishi Javia',
|
12
|
+
'Kevin Imber',
|
13
|
+
'Tony Vu',
|
13
14
|
]
|
14
|
-
s.email = [
|
15
|
-
s.homepage =
|
16
|
-
s.summary =
|
17
|
-
s.description =
|
15
|
+
s.email = ['voxpupuli@groups.io']
|
16
|
+
s.homepage = 'https://github.com/voxpupuli/beaker-docker'
|
17
|
+
s.summary = 'Docker hypervisor for Beaker acceptance testing framework'
|
18
|
+
s.description = 'Allows running Beaker tests using Docker'
|
18
19
|
s.license = 'Apache-2.0'
|
19
20
|
|
20
21
|
s.files = `git ls-files`.split("\n")
|
21
|
-
s.
|
22
|
-
s.
|
23
|
-
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
23
|
+
s.require_paths = ['lib']
|
24
|
+
|
25
|
+
s.required_ruby_version = '>= 2.7', '< 4'
|
24
26
|
|
25
27
|
# Testing dependencies
|
26
|
-
s.add_development_dependency '
|
27
|
-
s.add_development_dependency 'rspec-its', '~> 1.3'
|
28
|
-
s.add_development_dependency 'fakefs', '~> 1.3'
|
28
|
+
s.add_development_dependency 'fakefs', '>= 1.3', '< 3.0'
|
29
29
|
s.add_development_dependency 'rake', '~> 13.0'
|
30
|
-
s.add_development_dependency '
|
30
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
31
|
+
s.add_development_dependency 'rubocop', '~> 1.48.1'
|
31
32
|
s.add_development_dependency 'rubocop-performance', '~> 1.10'
|
32
33
|
s.add_development_dependency 'rubocop-rake', '~> 0.2'
|
33
34
|
s.add_development_dependency 'rubocop-rspec', '>= 1.44'
|
34
35
|
|
35
36
|
# Run time dependencies
|
36
|
-
s.add_runtime_dependency '
|
37
|
+
s.add_runtime_dependency 'beaker', '~> 5.0'
|
37
38
|
s.add_runtime_dependency 'docker-api', '~> 2.1'
|
38
|
-
s.add_runtime_dependency '
|
39
|
+
s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
|
39
40
|
end
|
data/bin/beaker-docker
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'rubygems' unless defined?(Gem)
|
4
5
|
require 'beaker-docker'
|
5
6
|
|
6
|
-
VERSION_STRING =
|
7
|
-
"
|
7
|
+
VERSION_STRING = <<'VER'
|
8
8
|
_ .--.
|
9
9
|
( ` )
|
10
10
|
beaker-docker .-' `--,
|
@@ -14,19 +14,17 @@ VERSION_STRING =
|
|
14
14
|
;| _| _| _| '-'__,--'`--'
|
15
15
|
| _| _| _| _| |
|
16
16
|
_ || _| _| _| _| %s
|
17
|
-
_(
|
17
|
+
_( `--.\_| _| _| _|/
|
18
18
|
.-' )--,| _| _|.`
|
19
19
|
(__, (_ ) )_| _| /
|
20
|
-
`-.__
|
20
|
+
`-.__.\ _,--'\|__|__/
|
21
21
|
;____;
|
22
|
-
|
22
|
+
\YT/
|
23
23
|
||
|
24
|
-
|
24
|
+
|""|
|
25
25
|
'=='
|
26
|
-
|
26
|
+
VER
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
puts BeakerDocker::VERSION
|
28
|
+
puts VERSION_STRING % BeakerDocker::VERSION
|
31
29
|
|
32
30
|
exit 0
|