Skip to content

Commit

Permalink
tests: add in Vagrantfiles for running tests in nested virt
Browse files Browse the repository at this point in the history
This will allow one to bring up a clean env to run the tests in and
then throw it away. Right now the nested virt for virtualbox doesn't
work but hoping to work out the kinks with that one day.
  • Loading branch information
dustymabe committed Jul 21, 2016
1 parent 7fa3809 commit 741d245
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/libvirt/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

To bring up vagrant host:

vagrant up

To run tests:

vagrant ssh

and then:

cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/
gem install bundler
bundle install
bundle exec rake features
35 changes: 35 additions & 0 deletions test/libvirt/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|

config.ssh.insert_key = 'true'
config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs"

config.vm.provider :libvirt do |domain|
domain.memory = 4096
domain.cpus = 4
domain.nested = true
end

host = 'viv-libvirt' # vagrant in vagrant - to test libvirt
box = 'fedora/24-cloud-base'

config.vm.define host do | tmp |
tmp.vm.hostname = host
tmp.vm.box = box
end
config.vm.provision "shell", inline: <<-SHELL
rpms=(
libvirt-daemon-kvm # for vagrant libvirt support
make gcc ruby ruby-devel redhat-rpm-config # for building gems
gcc-c++ # for building unf_ext
libvirt-devel # for building ruby-libvirt gem
zlib-devel # for building nokogiri gem
git # for the git ls-files in gemspec file
bsdtar # used by vagrant to unpack box files
)
dnf install -y ${rpms[@]}
usermod -a -G libvirt vagrant
systemctl start libvirtd virtlogd
SHELL
end
17 changes: 17 additions & 0 deletions test/virtualbox/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# XXX Note this is not working right now as nested virt. I keep
# getting kernel tracebacks on Fedora 24.

To bring up vagrant host:

vagrant up

To run tests:

vagrant ssh

and then:

cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/
gem install bundler
bundle install
bundle exec rake features
42 changes: 42 additions & 0 deletions test/virtualbox/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# XXX Note this is not working right now as nested virt. I keep
# getting kernel tracebacks on Fedora 24.
#
Vagrant.configure(2) do |config|

config.ssh.insert_key = 'true'
config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs"

config.vm.provider :libvirt do |domain|
domain.memory = 4096
domain.cpus = 4
domain.nested = true
end

host = 'viv-virtbox' # vagrant in vagrant - to test virtbox
box = 'fedora/24-cloud-base'

config.vm.define host do | tmp |
tmp.vm.hostname = host
tmp.vm.box = box
end
# Must use VirtualBox-5.0 - 5.1 not supported by Vagrant yet
config.vm.provision "shell", inline: <<-SHELL
dnf config-manager --add-repo http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
rpms=(
kernel-devel-$(uname -r) kernel-headers-$(uname -r)
gcc make VirtualBox-5.0 # all for virtualbox support
make gcc ruby ruby-devel redhat-rpm-config # for building gems
gcc-c++ # for building unf_ext
libvirt-devel # for building ruby-libvirt gem
zlib-devel # for building nokogiri gem
git # for the git ls-files in gemspec file
bsdtar # used by vagrant to unpack box files
)
dnf install -y ${rpms[@]}
/usr/lib/virtualbox/vboxdrv.sh setup
usermod -a -G vboxusers vagrant
SHELL
end

0 comments on commit 741d245

Please sign in to comment.