From 3d4a133dcefa4c5c15aa3bf569b2d7ae1cfa9a00 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Wed, 25 Nov 2015 00:23:19 +0200 Subject: [PATCH] Add acceptance test for linked clones --- .../provider-virtualbox/linked_clone_spec.rb | 35 +++++++++++++++++++ .../skeletons/linked_clone/Vagrantfile | 7 ++++ 2 files changed, 42 insertions(+) create mode 100644 test/acceptance/provider-virtualbox/linked_clone_spec.rb create mode 100644 test/acceptance/skeletons/linked_clone/Vagrantfile diff --git a/test/acceptance/provider-virtualbox/linked_clone_spec.rb b/test/acceptance/provider-virtualbox/linked_clone_spec.rb new file mode 100644 index 000000000..22785f1c7 --- /dev/null +++ b/test/acceptance/provider-virtualbox/linked_clone_spec.rb @@ -0,0 +1,35 @@ +# This tests that VM is up as a linked clone +shared_examples 'provider/linked_clone' do |provider, options| + if !options[:box] + raise ArgumentError, + "box option must be specified for provider: #{provider}" + end + + include_context 'acceptance' + + before do + environment.skeleton('linked_clone') + assert_execute('vagrant', 'box', 'add', 'basic', options[:box]) + end + + after do + assert_execute('vagrant', 'destroy', '--force') + end + + it 'creates machine as linked clone' do + status('Test: machine is created successfully') + result = execute('vagrant', 'up', "--provider=#{provider}") + expect(result).to exit_with(0) + + status('Test: master VM is created') + expect(result.stdout).to match(/master VM/) + + status('Test: machine is a master VM clone') + expect(result.stdout).to match(/Cloning/) + + status('Test: machine is available by ssh') + result = execute('vagrant', 'ssh', '-c', 'echo foo') + expect(result).to exit_with(0) + expect(result.stdout).to match(/foo\n$/) + end +end diff --git a/test/acceptance/skeletons/linked_clone/Vagrantfile b/test/acceptance/skeletons/linked_clone/Vagrantfile new file mode 100644 index 000000000..4562b9cf9 --- /dev/null +++ b/test/acceptance/skeletons/linked_clone/Vagrantfile @@ -0,0 +1,7 @@ +Vagrant.configure('2') do |config| + config.vm.box = 'basic' + + config.vm.provider 'virtualbox' do |v| + v.linked_clone = true + end +end