Permalink
Browse files

[tests] add Berksfile and Vagrantfile for some integration testing

  • Loading branch information...
1 parent 39723e7 commit cfa04f9593aab819185254660fc987992fba11db Chris Lundquist committed Nov 8, 2012
Showing with 81 additions and 0 deletions.
  1. +2 −0 Berksfile
  2. +78 −0 Vagrantfile
  3. +1 −0 metadata.rb
View
2 Berksfile
@@ -0,0 +1,2 @@
+cookbook 'apt'
+cookbook 'build-essential'
View
78 Vagrantfile
@@ -0,0 +1,78 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+begin
+ require 'active_support/core_ext/hash/deep_merge'
+rescue LoadError => e
+ STDERR.puts '', "[!] ERROR -- Please install ActiveSupport (gem install activesupport)", '-'*80, ''
+ raise e
+end
+
+# Automatically install and mount cookbooks from Berksfile
+#
+require 'berkshelf/vagrant'
+
+distributions = {
+ 'opscode-ubuntu-12.04' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ },
+
+ 'opscode-ubuntu-12.04-i386' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-12.04-i386.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ },
+
+ 'opscode-ubuntu-10.04' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-10.04.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ },
+
+ 'opscode-centos6.3' => {
+ :url => 'https://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-centos-6.3.box',
+ :run_list => %w| nodejs::install_from_source nodejs::install_from_package nodejs::npm|,
+ :node => {}
+ }
+}
+
+node_config = {
+}
+
+Vagrant::Config.run do |config|
+
+ distributions.each_pair do |name, options|
+
+ config.vm.define name, :options => options[:primary] do |box_config|
+
+ box_config.vm.box = name.to_s
+ box_config.vm.box_url = options[:url]
+
+ box_config.vm.host_name = name.to_s
+
+ # Install latest Chef on the machine
+
+ box_config.vm.provision :shell do |shell|
+ version = ENV['CHEF'].match(/^\d+/) ? ENV['CHEF'] : nil
+ shell.inline = %Q{
+ test -d "apt-get" && apt-get update
+ test -d "chef-solo" || curl -# -L http://www.opscode.com/chef/install.sh | sudo bash -s -- #{version ? "-v #{version}" : ''}
+ }
+ end if ENV['CHEF']
+
+ # Provision the machine with Chef Solo
+ #
+ box_config.vm.provision :chef_solo do |chef|
+ chef.cookbooks_path = ['..', './tmp/cookbooks']
+ chef.provisioning_path = '/etc/vagrant-chef'
+ chef.log_level = :debug
+
+ chef.run_list = options[:run_list]
+ chef.json = node_config.deep_merge(options[:node])
+ end
+ end
+
+ end
+
+end
View
1 metadata.rb
@@ -13,6 +13,7 @@
recipe "nodejs::npm", "Installs npm from source - a package manager for node"
depends "build-essential"
+recommends "apt"
%w{ debian ubuntu centos redhat }.each do |os|
supports os

0 comments on commit cfa04f9

Please sign in to comment.