Add acceptance specs for provisioning and port forwarding

This commit is contained in:
Fabio Rehm 2013-04-20 20:02:56 -03:00
parent 72bbfe42de
commit af8e787cb2
2 changed files with 17 additions and 4 deletions

7
spec/Vagrantfile vendored
View file

@ -23,4 +23,11 @@ Vagrant.configure("2") do |config|
cache_dir = local_apt_cache(config.vm.box)
config.vm.synced_folder cache_dir, "/var/cache/apt/archives", id: "vagrant-apt-cache"
config.vm.provision :shell,
inline: 'mkdir -p /vagrant/tmp && echo -n "Provisioned" > /vagrant/tmp/provisioning'
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell,
inline: 'sudo apt-get install apache2 -y'
end

View file

@ -61,14 +61,20 @@ describe 'Sanity check' do
end
it 'mounts shared folders with the right permissions' do
vagrant_ssh 'mkdir -p /vagrant/tmp && echo "Shared" > /vagrant/tmp/shared'
shared_file_contents = File.read('/vagrant/spec/tmp/shared').chomp
vagrant_ssh 'mkdir -p /vagrant/tmp && echo -n "Shared" > /vagrant/tmp/shared'
shared_file_contents = File.read('/vagrant/spec/tmp/shared')
expect(shared_file_contents).to eq 'Shared'
end
it 'provisions the container based on Vagrantfile configs'
it 'provisions the container based on Vagrantfile configs' do
provisioned_file_contents = File.read('/vagrant/spec/tmp/provisioning')
expect(provisioned_file_contents).to eq 'Provisioned'
end
it 'forwards configured ports'
it 'forwards configured ports' do
output = `curl -s localhost:8080`.strip.chomp
expect(output).to include 'It works!'
end
end
context '`vagrant halt` on a running container' do