Skip to content

Commit

Permalink
Add integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelaferreira committed Jan 5, 2016
1 parent b7b8d59 commit 5b8a168
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/fixtures/cookbooks/test_vagrant_chef_zero/chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*file
*file.lock
bin
bundle
chefignore
spec
test
vendor
.git
.*
dev.*
*_dev
8 changes: 8 additions & 0 deletions test/fixtures/cookbooks/test_vagrant_chef_zero/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name 'test_vagrant_chef_zero'
maintainer 'The Authors'
maintainer_email '[email protected]'
license 'all_rights'
description 'Installs/Configures test_vagrant_chef_zero'
long_description 'Installs/Configures test_vagrant_chef_zero'
version '0.1.0'

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
log 'Converging test_vagrant_chef_zero::default'
15 changes: 15 additions & 0 deletions test/fixtures/environments/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test",
"description": "",
"cookbook_versions": {

},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {

},
"override_attributes": {

}
}
15 changes: 15 additions & 0 deletions test/fixtures/roles/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test",
"description": "",
"cookbook_versions": {

},
"json_class": "Chef::Role",
"chef_type": "role",
"default_attributes": {

},
"override_attributes": {

}
}
49 changes: 49 additions & 0 deletions test/integration/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

test_machines = {
'windows' => {
'box' => ENV['VAGRANT_TEST_WINDOWS_BOX'], # sbp_windows_2012_r2_20141211_1
'communicator' => :winrm,
'guest' => :windows
},
'centos' => {
'box' => ENV['VAGRANT_TEST_CENTOS_BOX'], # opscode-centos-7.1
'communicator' => :ssh,
'guest' => :linux
}
}

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
test_machines.each_pair do |name, options|
global_config.vm.define name do |config|

config.vm.box = options['box']

config.vm.communicator = options['communicator']
config.vm.guest = options['guest']

config.vm.provider 'virtualbox' do |vb|
vb.gui = true
end

config.berkshelf.enabled = true

config.omnibus.chef_version = 'latest'

config.chef_zero.cookbooks = [ '../fixtures/cookbooks' ]
config.chef_zero.environments = '../fixtures/environments'
config.chef_zero.roles = '../fixtures/roles'

config.vm.provision 'chef_client', run: 'always' do |chef|
chef.environment = 'test'
chef.add_role 'test'
chef.log_level = 'info'
chef.run_list = [ 'recipe[test_vagrant_chef_zero::default]' ]
end
end
end
end

0 comments on commit 5b8a168

Please sign in to comment.