- Notifications
You must be signed in to change notification settings - Fork28
Vagrant plugin that integrates serverspec
License
vvchik/vagrant-serverspec
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
vagrant-serverspec is avagrant plugin that implementsserverspec as a provisioner.
First, install the plugin.
$ vagrant plugin install vagrant-serverspec
in case of fork usage you need to build it first
gem build vagrant-serverspec.gemspec
(on windows you may use embedded vagrant ruby for that)
C:\HashiCorp\Vagrant\embedded\bin\gem.bat build vagrant-serverspec.gemspec
after that install plugin from filesystem
vagrant plugin install ./vagrant-serverspec-0.5.0.gem
Next, configure the provisioner in yourVagrantfile.
Vagrant.configure('2')do |config|config.vm.box='precise64'config.vm.box_url='http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box'config.vm.provision:shell,inline:<<-EOF sudo ufw allow 22 yes | sudo ufw enable EOFconfig.vm.provision:serverspecdo |spec|# pattern for specfiles to searchspec.pattern='*_spec.rb'# pattern for specfiles to ignore, similar to rspec's --exclude-pattern optionspec.exclude_pattern='but_not_*_spec.rb'# disable error if no specfile was found ( useful with dynamic specfile retrieving through another provisionner like Ansible Galaxy => specfiles can be saved into ansible role repository for example ). Default: truespec.error_no_spec_files=false# save result into html an report, saved into a 'rspec_html_reports' directory. Default: falsespec.html_output=true# save result into junit xml report, default file name is 'rspec.xml'spec.junit_output=true# set custom junit xml report file namespec.junit_output_file='junit.xml'endend
You may want to override standard settings; a file namedspec_helper.rb is usually used for that. Here are some examples of possible overrides.
# Disable sudo# set :disable_sudo, true# Set environment variables# set :env, :LANG => 'C', :LC_MESSAGES => 'C'# Set PATH# set :path, '/sbin:/usr/local/sbin:$PATH'
Then you're ready to write your specs.
require_relative'spec_helper'describepackage('ufw')doit{shouldbe_installed}enddescribeservice('ufw')doit{shouldbe_enabled}it{shouldbe_running}enddescribeport(22)doit{shouldbe_listening}end
##Testing Docker Containers on OSXOn OSX the Vagrant docker provider runs a Boot2Docker VM, then launches your docker container on that VM. Vagrant does SSH Proxying to send the commands through that VM and have them reach the Docker Container. Vagrant serverspec handles this the same way by getting the container host VM infromation and proxying the commands to the machine through an SSH Proxy. This functionality was introduced in thisPR
SSH connection is closed before each provision run.This is mandatory if the provision is applied to multiple vms in the same run,else all runs will be applied to the first vm (See #22) due to an SSHconnection which already exists.This functionality was introduced in thisPR
RSpec examples are clear before each provision run.This is mandatory if the provision is applied to multiple vms in the same run,else each run replay examples of previous calls also.This functionality was introduced in thisPR
If you use shared examples into your test suite, you need to use 'load' insteadof 'require', else errors can occurs (See #23 comments).
vagrant-serverspec aims to adhere toSemantic Versioning 2.0.0.
- Source hosted atGitHub
- Report issues/questions/feature requests onGitHub Issues
Pull requests are very welcome! Make sure your patches are well tested.Ideally create a topic branch for every separate change you make. Forexample:
- Fork the repo
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Original IdeaJeremy Voorhis (jvoorhis@gmail.com).
Current version author and maintainerVladimir Babchynskyy (vvchik@gmail.com)
and a growing community ofcontributors.
MIT license (seeLICENSE)
About
Vagrant plugin that integrates serverspec
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.