mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Move existing tests executed with the help of bats to use rspec directly combined with tags to filter them out from being executed by default. This allows for more complex assertions as well as easier debug as the code supports use of setting 'VAGRANT_SPEC_SKIP_CLEANUP' to prevent the tests from removing the temporary directory created for home and work directories. Extend a number of classes from vagrant-spec to override default behaviour to allow passing of additional environment variables for packaging tests, as well as supporting the skip cleanup. Given the use of after to perform the cleanup, need to vendor the vagrant-spec acceptance context in order to modify it easily.
30 lines
854 B
Ruby
30 lines
854 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe 'handle two disk machine', acceptance: true do
|
|
include_context 'libvirt_acceptance'
|
|
|
|
after do
|
|
assert_execute('vagrant', 'destroy', '--force')
|
|
end
|
|
|
|
before do
|
|
environment.skeleton('two_disks')
|
|
environment.execute(File.expand_path('../../tools/create_box_with_two_disks.sh', __dir__),
|
|
environment.homedir.to_s, 'vagrant')
|
|
end
|
|
|
|
it 'should succeed' do
|
|
status('Test: machine is created successfully')
|
|
result = environment.execute('vagrant', 'up')
|
|
expect(result).to exit_with(0)
|
|
|
|
status('Test: disk one referenced')
|
|
expect(result.stdout).to match(/Image\(vda\):.*work_default.img, virtio, 2G/)
|
|
|
|
status('Test: disk two referenced')
|
|
expect(result.stdout).to match(/Image\(vdb\):.*work_default_1.img, virtio, 10G/)
|
|
end
|
|
end
|