From b17fb7baa8a79878797ed04434a05f0bc594887d Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sun, 4 May 2014 20:50:04 -0300 Subject: [PATCH] Fix broken specs --- spec/unit/driver/cli_spec.rb | 16 ++++++++++------ spec/unit/driver_spec.rb | 20 ++++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/spec/unit/driver/cli_spec.rb b/spec/unit/driver/cli_spec.rb index e97fc33..2c4501c 100644 --- a/spec/unit/driver/cli_spec.rb +++ b/spec/unit/driver/cli_spec.rb @@ -41,10 +41,12 @@ describe Vagrant::LXC::Driver::CLI do end describe 'create' do - let(:template) { 'quantal-64' } - let(:name) { 'quantal-container' } - let(:config_file) { 'config' } - let(:template_args) { { '--extra-param' => 'param', '--other' => 'value' } } + let(:template) { 'quantal-64' } + let(:name) { 'quantal-container' } + let(:backingstore) { 'btrfs' } + let(:backingstore_opts) { [['--dir', '/tmp/foo'], ['--foo', 'bar']] } + let(:config_file) { 'config' } + let(:template_args) { { '--extra-param' => 'param', '--other' => 'value' } } subject { described_class.new(sudo_wrapper, name) } @@ -53,9 +55,11 @@ describe Vagrant::LXC::Driver::CLI do end it 'issues a lxc-create with provided template, container name and hash of arguments' do - subject.create(template, config_file, template_args) + subject.create(template, backingstore, backingstore_opts, config_file, template_args) expect(subject).to have_received(:run).with( :create, + '-B', backingstore, + *(backingstore_opts.flatten), '--template', template, '--name', name, '-f', config_file, @@ -68,7 +72,7 @@ describe Vagrant::LXC::Driver::CLI do it 'wraps a low level error into something more meaningful in case the container already exists' do allow(subject).to receive(:run) { raise Vagrant::LXC::Errors::ExecuteError, stderr: 'alreAdy Exists' } expect { - subject.create(template, config_file, template_args) + subject.create(template, backingstore, backingstore_opts, config_file, template_args) }.to raise_error(Vagrant::LXC::Errors::ContainerAlreadyExists) end end diff --git a/spec/unit/driver_spec.rb b/spec/unit/driver_spec.rb index 8b8a3e9..b1089c1 100644 --- a/spec/unit/driver_spec.rb +++ b/spec/unit/driver_spec.rb @@ -31,19 +31,21 @@ describe Vagrant::LXC::Driver do end describe 'creation' do - let(:name) { 'container-name' } - let(:template_name) { 'auto-assigned-template-id' } - let(:template_path) { '/path/to/lxc-template-from-box' } - let(:template_opts) { {'--some' => 'random-option'} } - let(:config_file) { '/path/to/lxc-config-from-box' } - let(:rootfs_tarball) { '/path/to/cache/rootfs.tar.gz' } - let(:cli) { double(Vagrant::LXC::Driver::CLI, :create => true, :name= => true) } + let(:name) { 'container-name' } + let(:backingstore) { 'btrfs' } + let(:backingstore_opts) { [['--dir', '/tmp/foo'], ['--foo', 'bar']] } + let(:template_name) { 'auto-assigned-template-id' } + let(:template_path) { '/path/to/lxc-template-from-box' } + let(:template_opts) { {'--some' => 'random-option'} } + let(:config_file) { '/path/to/lxc-config-from-box' } + let(:rootfs_tarball) { '/path/to/cache/rootfs.tar.gz' } + let(:cli) { double(Vagrant::LXC::Driver::CLI, :create => true, :name= => true) } subject { described_class.new(nil, nil, cli) } before do allow(subject).to receive(:import_template).and_yield(template_name) - subject.create name, template_path, config_file, template_opts + subject.create name, backingstore, backingstore_opts, template_path, config_file, template_opts end it 'sets the cli object container name' do @@ -53,6 +55,8 @@ describe Vagrant::LXC::Driver do it 'creates container with the right arguments' do expect(cli).to have_received(:create).with( template_name, + backingstore, + backingstore_opts, config_file, template_opts )