beaker-lima 1.0.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.
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
4
+ require 'beaker-lima/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'beaker-lima'
8
+ s.version = BeakerLima::VERSION
9
+ s.summary = 'Lima hypervisor for Beaker acceptance testing framework'
10
+ s.description = 'Allows running Beaker tests using Lima'
11
+ s.authors = ['Yury Bushmelev', 'Vox Pupuli']
12
+ s.email = 'voxpupuli@groups.io'
13
+ s.files = `git ls-files`.split("\n")
14
+ s.homepage = 'https://github.com/voxpupuli/beaker-lima'
15
+ s.license = 'Apache-2.0'
16
+
17
+ s.required_ruby_version = '>= 3.0'
18
+
19
+ s.add_development_dependency 'fakefs', '>= 1.3', '< 4.0'
20
+ s.add_development_dependency 'rake', '< 14'
21
+ s.add_development_dependency 'rspec', '< 4'
22
+ s.add_development_dependency 'voxpupuli-rubocop', '~> 3.0'
23
+
24
+ s.add_dependency 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
25
+ s.add_dependency 'beaker', '>= 5', '< 8'
26
+ end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Beaker
4
+ # beaker extenstion to manage Lima VMs: https://github.com/lima-vm/lima
5
+ class Lima < Beaker::Hypervisor
6
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act
7
+ # upon, or a role (String or Symbol) that identifies one or more hosts.
8
+ # @param [Hash{Symbol=>String}] options Options to pass on to the hypervisor
9
+ def initialize(hosts, options)
10
+ require 'beaker/hypervisor/lima_helper'
11
+
12
+ super
13
+ @logger = options[:logger] || Beaker::Logger.new
14
+ @limahelper = options[:lima_helper] || LimaHelper.new(options)
15
+ end
16
+
17
+ def provision
18
+ @logger.notify 'Provisioning Lima'
19
+ @hosts.each do |host|
20
+ @logger.notify "provisioning #{host.name}"
21
+ @limahelper.start(host.name, host[:lima])
22
+ vm_opts = @limahelper.list([host.name]).first
23
+ @logger.info "vm_opts: #{vm_opts}\n"
24
+ setup_ssh(host)
25
+ @logger.debug "node available at #{host[:ip]}:#{host[:port]}"
26
+ end
27
+ hack_etc_hosts @hosts, @options
28
+ end
29
+
30
+ def cleanup
31
+ @logger.notify 'Cleaning up Lima'
32
+ @hosts.each do |host|
33
+ @logger.debug "stopping #{host.name}"
34
+ @limahelper.stop(host.name)
35
+ @limahelper.delete(host.name)
36
+ end
37
+ end
38
+
39
+ def connection_preference(_host)
40
+ [:ip]
41
+ end
42
+
43
+ private
44
+
45
+ def setup_ssh(host)
46
+ @logger.debug 'configure lima VMs (set ssh-config, switch to root user, hack etc/hosts)'
47
+
48
+ default_user = host[:user] # root
49
+
50
+ ssh_config = convert_ssh_opts(host)
51
+ host[:ip] = '127.0.0.1'
52
+ host[:port] = ssh_config[:port]
53
+ host[:ssh] = host[:ssh].merge(ssh_config)
54
+ host[:user] = ssh_config[:user]
55
+
56
+ # copy user's keys to roots home dir, to allow for login as root
57
+ copy_ssh_to_root host, @options
58
+ # ensure that root login is enabled for this host
59
+ enable_root_login host, @options
60
+ # shut down connection, will reconnect on next exec
61
+ host.close
62
+
63
+ host[:user] = default_user
64
+ host[:ssh][:user] = default_user
65
+ end
66
+
67
+ # Convert lima ssh opts to beaker (Net::SSH) ssh opts
68
+ def convert_ssh_opts(host)
69
+ cfg = @limahelper.ssh_info(host.name)
70
+ forward_ssh_agent = @options[:forward_ssh_agent] || false
71
+ keys_only = if @options[:forward_ssh_agent] == true
72
+ false
73
+ else
74
+ (cfg['IdentitiesOnly'] || 'yes') == 'yes'
75
+ end
76
+
77
+ {
78
+ forward_agent: forward_ssh_agent,
79
+ host_name: cfg['Hostname'],
80
+ keys: cfg['IdentityFile'],
81
+ keys_only: keys_only,
82
+ port: cfg['Port'],
83
+ use_agent: forward_ssh_agent,
84
+ user: cfg['User'],
85
+ }
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,166 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Beaker
4
+ # Beaker helper module to interact with Lima CLI
5
+ class LimaHelper
6
+ class LimaError < StandardError
7
+ end
8
+
9
+ def initialize(options)
10
+ require 'json'
11
+ require 'open3'
12
+ require 'shellwords'
13
+
14
+ @options = options
15
+ @logger = options[:logger]
16
+
17
+ @limactl = @options[:limactl] || 'limactl'
18
+ @ssh_info = {}
19
+ @timeout = @options[:timeout] || (60 * 10)
20
+ end
21
+
22
+ def list(vm_names = [])
23
+ lima_cmd = [@limactl, 'list', '--json']
24
+ vm_names.each { |vm_name| lima_cmd << vm_name }
25
+ stdout_str, stderr_str, status = Open3.capture3(*lima_cmd)
26
+ unless status.success?
27
+ raise LimaError, "`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}"
28
+ end
29
+
30
+ stdout_str.split("\n").map { |vm| JSON.parse(vm) }
31
+ end
32
+
33
+ # A bit faster `list` variant to check the VM status
34
+ def status(vm_name)
35
+ lima_cmd = [@limactl, 'list', '--format', '{{ .Status }}', vm_name]
36
+ @logger.debug "running command #{lima_cmd.join(' ')}"
37
+ stdout_str, stderr_str, status = Open3.capture3(*lima_cmd)
38
+ @logger.debug "stdout: #{stdout_str}, stderr: #{stderr_str}, status: #{status}"
39
+
40
+ if status.success?
41
+ stdout_str.chomp
42
+ elsif stderr_str.include?('No instance matching')
43
+ ''
44
+ else
45
+ raise LimaError, "`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}"
46
+ end
47
+ end
48
+
49
+ def start(vm_name, cfg = {})
50
+ case status(vm_name)
51
+ when ''
52
+ return create(vm_name, cfg)
53
+ when 'Running'
54
+ @logger.debug("'#{vm_name}' is running already, skipping...")
55
+ return true
56
+ end
57
+
58
+ lima_cmd = [@limactl, 'start', "--timeout=#{@timeout}s", vm_name]
59
+ _, stderr_str, status = Open3.capture3(*lima_cmd)
60
+ unless status.success?
61
+ raise LimaError, "`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}"
62
+ end
63
+
64
+ true
65
+ end
66
+
67
+ def create(vm_name, cfg = {})
68
+ @logger.debug("Options: #{cfg}")
69
+ raise LimaError, 'Only one of url/template/config parameters must be specified' if cfg[:url] && cfg[:config]
70
+
71
+ if cfg[:url]
72
+ cfg_url = cfg[:url]
73
+ elsif cfg[:config]
74
+ # Write config to a temporary YAML file and pass it to limactl later
75
+ safe_name = Shellwords.escape(vm_name)
76
+ tmpfile = Tempfile.new(["lima_#{safe_name}", '.yaml'])
77
+ # config has symbolized keys by default. So .to_yaml will write keys as :symbols.
78
+ # Keys should be stringified to avoid this so Lima can parse the YAML properly.
79
+ tmpfile.write(stringify_keys_recursively(cfg[:config]).to_yaml)
80
+ tmpfile.close
81
+
82
+ # Validate the config
83
+ _, stderr_str, status = Open3.capture3(@limactl, 'validate', tmpfile.path)
84
+ raise LimaError, "Config validation fails with error: #{stderr_str}" unless status.success?
85
+
86
+ cfg_url = tmpfile.path
87
+ else
88
+ raise LimaError, 'At least one of url/template/config parameters must be specified'
89
+ end
90
+
91
+ lima_cmd = [@limactl, 'start', "--name=#{vm_name}", "--timeout=#{@timeout}s", cfg_url]
92
+ _, stderr_str, status = Open3.capture3(*lima_cmd)
93
+ tmpfile&.unlink # Delete tmpfile if any
94
+
95
+ unless status.success?
96
+ raise LimaError, "`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}"
97
+ end
98
+
99
+ true
100
+ end
101
+
102
+ def stop(vm_name)
103
+ lima_cmd = [@limactl, 'stop', vm_name]
104
+ _, stderr_str, status = Open3.capture3(*lima_cmd)
105
+
106
+ # `limactl stop` might fail sometimes though VM is stopped actually
107
+ # Performing additional check
108
+ return true if status(vm_name) == 'Stopped'
109
+
110
+ @logger.warn("`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}")
111
+ false
112
+ end
113
+
114
+ def delete(vm_name)
115
+ lima_cmd = [@limactl, 'delete', vm_name]
116
+ _, stderr_str, status = Open3.capture3(*lima_cmd)
117
+
118
+ # `limactl delete` might fail sometimes though VM is deleted actually
119
+ # Performing additional check
120
+ return true if status(vm_name).empty?
121
+
122
+ @logger.warn("`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}")
123
+ false
124
+ end
125
+
126
+ def ssh_info(vm_name)
127
+ return @ssh_info[vm_name] if @ssh_info.key? vm_name
128
+
129
+ lima_cmd = [@limactl, 'show-ssh', '--format', 'options', vm_name]
130
+ stdout_str, stderr_str, status = Open3.capture3(*lima_cmd)
131
+
132
+ if stdout_str.empty?
133
+ @logger.warn("`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}")
134
+ return {}
135
+ end
136
+
137
+ # Convert key=value to [key],[value] pairs array
138
+ vm_opts_pairs = Shellwords.shellwords(stdout_str).map { |x| x.split('=', 2) }
139
+
140
+ # Collect all IdentityFile values
141
+ identity_files = vm_opts_pairs.filter { |x| x[0] == 'IdentityFile' }.map { |x| x[1] }
142
+
143
+ # Convert pairs array to a hash
144
+ vm_opts = Hash[*vm_opts_pairs.flatten]
145
+ vm_opts['IdentityFile'] = identity_files
146
+ vm_opts['Port'] = vm_opts['Port'].to_i
147
+
148
+ @ssh_info[vm_name] = vm_opts
149
+ end
150
+
151
+ # Stringify Hash keys recursively
152
+ def stringify_keys_recursively(hash)
153
+ stringified_hash = {}
154
+ hash.each do |k, v|
155
+ stringified_hash[k.to_s] = if v.is_a?(Hash)
156
+ stringify_keys_recursively(v)
157
+ elsif v.is_a?(Array)
158
+ v.map { |x| x.is_a?(Hash) ? stringify_keys_recursively(x) : x }
159
+ else
160
+ v
161
+ end
162
+ end
163
+ stringified_hash
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeakerLima
4
+ VERSION = '1.0.1'
5
+ end
@@ -0,0 +1,203 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Beaker::LimaHelper unit tests
6
+ module Beaker
7
+ describe LimaHelper do
8
+ let(:options) do
9
+ {
10
+ logger: logger,
11
+ timeout: 900,
12
+ }
13
+ end
14
+ let(:lima_success) do
15
+ rc = instance_double(Process::Status)
16
+ allow(rc).to receive_messages(success?: true, exitstatus: 0)
17
+ rc
18
+ end
19
+ let(:lima_failure) do
20
+ rc = instance_double(Process::Status)
21
+ allow(rc).to receive_messages(success?: false, exitstatus: 123)
22
+ rc
23
+ end
24
+ let(:lima_result) { lima_success }
25
+ let(:vm_name) { 'test_vm' }
26
+ let(:vm_status) { '' }
27
+ let(:lima_helper) { described_class.new(options) }
28
+
29
+ describe '#list' do
30
+ let(:limactl_list) do
31
+ [
32
+ { 'name' => 'docker', 'status' => 'Running' },
33
+ { 'name' => 'podman', 'status' => 'Stopped' },
34
+ ]
35
+ end
36
+ let(:limactl_stdout) { limactl_list.map(&:to_json).join("\n") }
37
+
38
+ it 'returns `limactl list` output' do
39
+ allow(Open3).to receive(:capture3).with('limactl', 'list', '--json', 'docker', 'podman')
40
+ .and_return([limactl_stdout, '', lima_success])
41
+
42
+ result = lima_helper.list(%w[docker podman])
43
+ expect(Open3).to have_received(:capture3).with('limactl', 'list', '--json', 'docker', 'podman').once
44
+ expect(result).to eq(limactl_list)
45
+ end
46
+ end
47
+
48
+ describe '#status' do
49
+ let(:vm_status) { 'Running' }
50
+ let(:limactl_list) { [{ 'name' => vm_name, 'status' => vm_status }] }
51
+
52
+ it 'returns the VM status' do
53
+ allow(Open3).to receive(:capture3).with('limactl', 'list', '--format', '{{ .Status }}', vm_name)
54
+ .and_return([vm_status, '', lima_result])
55
+
56
+ result = lima_helper.status(vm_name)
57
+ expect(Open3).to have_received(:capture3).with('limactl', 'list', '--format', '{{ .Status }}', vm_name).once
58
+ expect(result).to eq(vm_status)
59
+ end
60
+ end
61
+
62
+ describe '#start' do
63
+ context 'with existsing VM' do
64
+ let(:vm_status) { 'Stopped' }
65
+
66
+ it 'starts the VM' do
67
+ allow(lima_helper).to receive(:status).and_return(vm_status)
68
+ allow(Open3).to receive(:capture3).with('limactl', 'start', "--timeout=#{options[:timeout]}s", vm_name)
69
+ .and_return([vm_status, '', lima_success])
70
+
71
+ result = lima_helper.start(vm_name)
72
+ expect(lima_helper).to have_received(:status).once
73
+ expect(Open3).to have_received(:capture3)
74
+ .with('limactl', 'start', "--timeout=#{options[:timeout]}s", vm_name)
75
+ .once
76
+ expect(result).to be true
77
+ end
78
+ end
79
+
80
+ context 'with non-existent VM name' do
81
+ it 'creates the VM' do
82
+ allow(lima_helper).to receive(:status).and_return(vm_status)
83
+ allow(lima_helper).to receive(:create).with(vm_name, {}).and_return(true)
84
+
85
+ result = lima_helper.start(vm_name)
86
+ expect(lima_helper).to have_received(:status).once
87
+ expect(lima_helper).to have_received(:create).with(vm_name, {}).once
88
+ expect(result).to be true
89
+ end
90
+ end
91
+ end
92
+
93
+ describe '#create' do
94
+ context 'with url' do
95
+ let(:cfg) { { url: 'template://ubuntu-lts' } }
96
+
97
+ it 'creates the VM' do
98
+ allow(Open3).to receive(:capture3)
99
+ .with('limactl', 'start', "--name=#{vm_name}", "--timeout=#{options[:timeout]}s", cfg[:url])
100
+ .and_return(['', '', lima_success])
101
+
102
+ result = lima_helper.create(vm_name, cfg)
103
+ expect(Open3).to have_received(:capture3)
104
+ .with('limactl', 'start', "--name=#{vm_name}", "--timeout=#{options[:timeout]}s", cfg[:url])
105
+ .once
106
+ expect(result).to be true
107
+ end
108
+ end
109
+
110
+ context 'with config' do
111
+ let(:cfg) { { config: { images: ['https://example.com/lima.qcow2'] } } }
112
+ let(:tmpfile) { Tempfile.new(["lima_#{vm_name}", '.yaml']) }
113
+
114
+ before do
115
+ allow(Tempfile).to receive(:new).and_return(tmpfile)
116
+ end
117
+
118
+ after do
119
+ tmpfile.close
120
+ tmpfile.unlink
121
+ end
122
+
123
+ it 'creates the VM' do
124
+ saved_path = tmpfile.path
125
+ allow(Open3).to receive(:capture3).with('limactl', 'validate', saved_path)
126
+ .and_return(['', '', lima_success])
127
+ allow(Open3).to receive(:capture3)
128
+ .with('limactl', 'start', "--name=#{vm_name}", "--timeout=#{options[:timeout]}s", saved_path)
129
+ .and_return(['', '', lima_success])
130
+
131
+ result = lima_helper.create(vm_name, cfg)
132
+ expect(Open3).to have_received(:capture3).with('limactl', 'validate', saved_path).once
133
+ expect(Open3).to have_received(:capture3)
134
+ .with('limactl', 'start', "--name=#{vm_name}", "--timeout=#{options[:timeout]}s", saved_path)
135
+ .once
136
+ expect(result).to be true
137
+ end
138
+ end
139
+ end
140
+
141
+ describe '#stop' do
142
+ let(:vm_status) { 'Stopped' }
143
+
144
+ it 'stops the VM' do
145
+ allow(lima_helper).to receive(:status).and_return(vm_status)
146
+ allow(Open3).to receive(:capture3).with('limactl', 'stop', vm_name)
147
+ .and_return(['', '', lima_success])
148
+
149
+ result = lima_helper.stop(vm_name)
150
+ expect(lima_helper).to have_received(:status).once
151
+ expect(Open3).to have_received(:capture3).with('limactl', 'stop', vm_name).once
152
+ expect(result).to be(true)
153
+ end
154
+ end
155
+
156
+ describe '#delete' do
157
+ it 'deletes the VM' do
158
+ allow(lima_helper).to receive(:status).and_return(vm_status)
159
+ allow(Open3).to receive(:capture3).with('limactl', 'delete', vm_name)
160
+ .and_return(['', '', lima_success])
161
+
162
+ result = lima_helper.delete(vm_name)
163
+ expect(lima_helper).to have_received(:status).once
164
+ expect(Open3).to have_received(:capture3).with('limactl', 'delete', vm_name).once
165
+ expect(result).to be(true)
166
+ end
167
+ end
168
+
169
+ describe '#ssh_info' do
170
+ let(:limactl_stdout) do
171
+ <<~LIMA
172
+ IdentityFile="/home/test/.lima/_config/user"
173
+ IdentityFile="/home/test/.ssh/id_rsa"
174
+ PreferredAuthentications=publickey
175
+ User=test
176
+ Hostname=127.0.0.1
177
+ Port=54321
178
+ LIMA
179
+ end
180
+ let(:ssh_info) do
181
+ {
182
+ 'IdentityFile' => [
183
+ '/home/test/.lima/_config/user',
184
+ '/home/test/.ssh/id_rsa',
185
+ ],
186
+ 'PreferredAuthentications' => 'publickey',
187
+ 'User' => 'test',
188
+ 'Hostname' => '127.0.0.1',
189
+ 'Port' => 54_321,
190
+ }
191
+ end
192
+
193
+ it 'returns the VM ssh connection info' do
194
+ allow(Open3).to receive(:capture3).with('limactl', 'show-ssh', '--format', 'options', vm_name)
195
+ .and_return([limactl_stdout, '', lima_success])
196
+
197
+ result = lima_helper.ssh_info(vm_name)
198
+ expect(Open3).to have_received(:capture3).with('limactl', 'show-ssh', '--format', 'options', vm_name).once
199
+ expect(result).to eq(ssh_info)
200
+ end
201
+ end
202
+ end
203
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Beaker::Lima unit tests
6
+ module Beaker
7
+ describe Lima do
8
+ let(:hosts) do
9
+ the_hosts = make_hosts
10
+ the_hosts[0][:lima] = { url: 'template://ubuntu-lts' }
11
+ the_hosts[1][:lima] = { config: { images: [] } }
12
+ the_hosts
13
+ end
14
+
15
+ let(:logger) do
16
+ logger = instance_double(Logger)
17
+ allow(logger).to receive(:debug)
18
+ allow(logger).to receive(:info)
19
+ allow(logger).to receive(:warn)
20
+ allow(logger).to receive(:error)
21
+ allow(logger).to receive(:notify)
22
+ logger
23
+ end
24
+
25
+ let(:options) do
26
+ {
27
+ logger: logger,
28
+ lima_helper: lima_helper,
29
+ forward_ssh_agent: true,
30
+ provision: true,
31
+ }
32
+ end
33
+
34
+ let(:ssh_info_hash) do
35
+ {
36
+ hosts[0].name => {
37
+ 'IdentityFile' => [
38
+ '/home/test/.lima/_config/user',
39
+ '/home/test/.ssh/id_rsa',
40
+ ],
41
+ 'PreferredAuthentications' => 'publickey',
42
+ 'User' => 'test',
43
+ 'Hostname' => '127.0.0.1',
44
+ 'Port' => 54_321,
45
+ },
46
+ hosts[1].name => {
47
+ 'IdentityFile' => [
48
+ '/home/test/.lima/_config/user',
49
+ '/home/test/.ssh/id_rsa',
50
+ ],
51
+ 'PreferredAuthentications' => 'publickey',
52
+ 'User' => 'test',
53
+ 'Hostname' => '127.0.0.1',
54
+ 'Port' => 54_322,
55
+ },
56
+ hosts[2].name => {
57
+ 'IdentityFile' => [
58
+ '/home/test/.lima/_config/user',
59
+ '/home/test/.ssh/id_rsa',
60
+ ],
61
+ 'PreferredAuthentications' => 'publickey',
62
+ 'User' => 'test',
63
+ 'Hostname' => '127.0.0.1',
64
+ 'Port' => 54_323,
65
+ },
66
+ }
67
+ end
68
+
69
+ let(:lima) { described_class.new(hosts, options) }
70
+
71
+ let(:lima_helper) do
72
+ lh = instance_double(LimaHelper)
73
+ hosts.each do |host|
74
+ # [list, status] are missing here because they depedns on a test case
75
+ allow(lh).to receive(:start).with(host.name, host[:lima]).and_return(host.name)
76
+ allow(lh).to receive(:stop).with(host.name).and_return(true)
77
+ allow(lh).to receive(:ssh_info).with(host.name).and_return(ssh_info_hash[host.name])
78
+ allow(lh).to receive(:delete).with(host.name).and_return(true)
79
+ end
80
+ lh
81
+ end
82
+
83
+ describe '#provision' do
84
+ it 'provisions the VMs' do
85
+ hosts.each do |host|
86
+ allow(lima_helper).to receive(:list).with([host.name])
87
+ .and_return([{ 'name' => host.name, 'status' => 'Running' }])
88
+ end
89
+
90
+ lima.provision
91
+
92
+ hosts.each do |host|
93
+ expect(lima_helper).to have_received(:start).with(host.name, host[:lima]).once
94
+ expect(lima_helper).to have_received(:ssh_info).with(host.name).once
95
+ end
96
+ end
97
+ end
98
+
99
+ describe '#cleanup' do
100
+ it 'cleanups the VMs' do
101
+ lima.cleanup
102
+
103
+ hosts.each do |host|
104
+ allow(lima_helper).to receive(:list).with([host.name]).and_return([])
105
+
106
+ expect(lima_helper).to have_received(:stop).with(host.name).once
107
+ expect(lima_helper).to have_received(:delete).with(host.name).once
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'beaker'
4
+
5
+ Dir['./lib/beaker/hypervisor/*.rb'].each { |file| require file }
6
+
7
+ # setup & require beaker's spec_helper.rb
8
+ beaker_gem_spec = Gem::Specification.find_by_name('beaker')
9
+ beaker_gem_dir = beaker_gem_spec.gem_dir
10
+ beaker_spec_path = File.join(beaker_gem_dir, 'spec')
11
+ $LOAD_PATH << beaker_spec_path
12
+ require File.join(beaker_spec_path, 'spec_helper.rb')
13
+
14
+ RSpec.configure do |config|
15
+ config.include TestFileHelpers
16
+ config.include HostHelpers
17
+ end