summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2016-01-27 11:47:57 -0800
committerJohn Keiser <john@johnkeiser.com>2016-01-27 11:47:57 -0800
commit6defab990c91e07361cc27a41d506338ca915527 (patch)
treec40093a47acffe5054b51b99a1a00b3900f8fe79
parentec5a892599282e5695a9495c0f2902a75531452a (diff)
parenta668b711c6e43b82d19303be2ff0949a92ead0a6 (diff)
downloadchef-6defab990c91e07361cc27a41d506338ca915527.tar.gz
Merge branch 'jk/acceptance-spinup'
-rw-r--r--acceptance/Gemfile2
-rw-r--r--acceptance/README.md49
-rw-r--r--acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb2
-rw-r--r--acceptance/cookbook-git/.kitchen.ec2.yml94
4 files changed, 106 insertions, 41 deletions
diff --git a/acceptance/Gemfile b/acceptance/Gemfile
index f9a0b5497e..5e6377badb 100644
--- a/acceptance/Gemfile
+++ b/acceptance/Gemfile
@@ -4,7 +4,7 @@ gem "mixlib-install", github: "chef/mixlib-install"
gem "chef", path: ".."
gem "chef-acceptance", github: "chef/chef-acceptance"
gem "test-kitchen", github: "sersut/test-kitchen", branch: "sersut/mixlib-install-update"
-gem "kitchen-ec2"
+gem "kitchen-ec2", github: "test-kitchen/kitchen-ec2", branch: "jk/image-search-only"
gem "kitchen-inspec"
gem "kitchen-vagrant"
gem "windows_chef_zero"
diff --git a/acceptance/README.md b/acceptance/README.md
index 8f957debb2..48fa672a7c 100644
--- a/acceptance/README.md
+++ b/acceptance/README.md
@@ -13,6 +13,53 @@ Before running chef-acceptance, you *MUST* do the following on your current sess
export APPBUNDLER_ALLOW_RVM=true
```
+## Pre-requisites / One time set up
+
+### Set up for local VM (Vagrant)
+
+If you intend to run the acceptance tests on a local VM, the supported solution is to use Vagrant.
+Ensure that Vagrant is installed on the machine that tests will run from, along with a
+virtualization driver (E.g.: VirtualBox).
+
+Set up the KITCHEN_DRIVER environment variable appropriately (value should be "vagrant"). E.g.:
+```
+export KITCHEN_DRIVER=vagrant
+```
+Add this to your shell profile or startup script as needed.
+
+### Set up for cloud VM (EC2)
+
+If you intend to run the acceptance tests on a cloud VM, the supported solution is to use EC2.
+
+The steps you will need to do are:
+
+1. Add your AWS credentials to the machine - e.g., to the ~/.aws/credentials directory.
+ - The easiest way to do this is to download the aws command line (`brew install awscli` on OS/X) and run `aws configure`.
+2. Create or import a SSH key to AWS. (If you already have one, you can skip the import/create)
+ - In the AWS console, click Key Pairs, then Create Key Pair or Import Key Pair.
+3. Copy or move the private key file (USERNAME.pem) to the SSH folder (e.g. `~/.ssh/USERNAME.pem`).
+ - If you Created a key pair in step 2, download the private key and move it to `~/.ssh`.
+ - If you Importd a key pair in step 2, just ensure your private key is in `~/.ssh` and has the same name as the key pair (`~/.ssh/USERNAME` or `~/.ssh/USERNAME.pem`).
+4. Set AWS_SSH_KEY_ID to the SSH key name.
+ - This is **optional** if your AWS SSH key name is your local username.
+ - You may want to set this in your shell `.profile`.
+
+ ```shell
+ export AWS_SSH_KEY_ID=name-of-private-key
+ ```
+5. Set the private key to only be readable by root
+
+ ```shell
+ chmod 0400 ~/.ssh/USERNAME.pem
+ ```
+6. Set up the KITCHEN_DRIVER environment variable appropriately (value should be "ec2"). (This is optional, as ec2 is the default.) E.g.:
+
+ ```shell
+ export KITCHEN_DRIVER=ec2
+ ```
+ Add this to your shell profile or startup script as needed.
+7. **Connect to Chef VPN**. The instances you create will not have public IPs!
+
### Setting up and running a test suite
To get started, do a bundle install from the acceptance directory:
```shell
@@ -35,3 +82,5 @@ To restrict which OS's will run, use the KITCHEN_INSTANCES environment variable:
chef/acceptance$ export KITCHEN_INSTANCES=*-ubuntu-1404
chef/acceptance$ bin/chef-acceptance test cookbook-git
```
+
+If KITCHEN_INSTANCES is not specified, the default instances are default-ubuntu-1404 and default-windows-windows-2012r2. All selected instances will be run in *parallel* if the driver supports it (ec2 does, vagrant doesn't).
diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb b/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb
index d40d6672e7..d3d3db451e 100644
--- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb
+++ b/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb
@@ -16,4 +16,4 @@ module CookbookGit
end
end
-ENV["KITCHEN_LOCAL_YAML"] ||= File.join(Chef.node["chef-acceptance"]["suite-dir"], ".kitchen.#{ENV["KITCHEN_DRIVER"] || "vagrant"}.yml")
+ENV["KITCHEN_LOCAL_YAML"] ||= File.join(Chef.node["chef-acceptance"]["suite-dir"], ".kitchen.#{ENV["KITCHEN_DRIVER"] || "ec2"}.yml")
diff --git a/acceptance/cookbook-git/.kitchen.ec2.yml b/acceptance/cookbook-git/.kitchen.ec2.yml
index 61413ea5ff..514d71a786 100644
--- a/acceptance/cookbook-git/.kitchen.ec2.yml
+++ b/acceptance/cookbook-git/.kitchen.ec2.yml
@@ -11,11 +11,7 @@ driver:
name: ec2
tags:
X-Project: Kitchen Tests
- aws_ssh_key_id: <%= ENV['AWS_SSH_KEY_ID'] || ENV['USER'] %>
- transport:
- ssh_key: <%= file_if_exists("~/.ssh/#{ENV['AWS_SSH_KEY_ID'] || ENV['USERNAME']}.pem") ||
- file_if_exists("~/.ssh/#{ENV['AWS_SSH_KEY_ID'] || ENV['USERNAME']}")
- file_if_exists("~/.ssh/id_rsa") %>
+ aws_ssh_key_id: <%= ENV['AWS_SSH_KEY_ID'] || ENV['USER'] || ENV['USERNAME'] %>
# test-specific stuff
region: us-west-2
availability_zone: a
@@ -24,6 +20,11 @@ driver:
instance_type: m3.large
associate_public_ip: true
+transport:
+ ssh_key: <%= file_if_exists("~/.ssh/#{ENV['AWS_SSH_KEY_ID'] || ENV['USER'] || ENV['USERNAME']}.pem") ||
+ file_if_exists("~/.ssh/#{ENV['AWS_SSH_KEY_ID'] || ENV['USER'] || ENV['USERNAME']}") ||
+ file_if_exists("~/.ssh/id_rsa") %>
+
platforms:
#
# AIX
@@ -42,7 +43,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: admin
- name: debian-7
@@ -54,7 +54,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: standard
image-type: machine
- instance_type: t2.micro
transport:
username: admin
#
@@ -69,7 +68,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: ubuntu
- name: ubuntu-14.04
@@ -81,7 +79,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: ubuntu
# - name: ubuntu-12.04
@@ -93,7 +90,6 @@ platforms:
# virtualization-type: hvm
# block-device-mapping.volume-type: gp2
# image-type: machine
- # instance_type: t2.micro
# transport:
# username: ubuntu
#
@@ -108,7 +104,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: ec2-user
- name: el-6
@@ -120,7 +115,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: ec2-user
- name: el-5
@@ -132,7 +126,6 @@ platforms:
virtualization-type: paravirtual
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t1.micro
transport:
username: ec2-user
#
@@ -147,7 +140,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: ec2-user
- name: freebsd-9
@@ -159,7 +151,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: ec2-user
# - name: freebsd-8
@@ -171,7 +162,6 @@ platforms:
# virtualization-type: hvm
# block-device-mapping.volume-type: standard
# image-type: machine
- # instance_type: t2.micro
# transport:
# username: ec2-user
#
@@ -202,26 +192,26 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
+ user_data: |
+ <powershell>
+ $logfile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\kitchen-ec2.log"
+ #PS Remoting and & winrm.cmd basic config
+ Enable-PSRemoting -Force -SkipNetworkProfileCheck
+ & winrm.cmd set winrm/config '@{MaxTimeoutms="1800000"}' >> $logfile
+ & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile
+ & winrm.cmd set winrm/config/winrs '@{MaxShellsPerUser="50"}' >> $logfile
+ #Server settings - support username/password login
+ & winrm.cmd set winrm/config/service/auth '@{Basic="true"}' >> $logfile
+ & winrm.cmd set winrm/config/service '@{AllowUnencrypted="true"}' >> $logfile
+ & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile
+ #Firewall Config
+ & netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any >> $logfile
+ #Set script execution to unrestricted
+ & Set-ExecutionPolicy Unrestricted -Force
+ </powershell>
transport:
username: administrator
- # user_data: |
- # <powershell>
- # $logfile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\kitchen-ec2.log"
- # #PS Remoting and & winrm.cmd basic config
- # Enable-PSRemoting -Force -SkipNetworkProfileCheck
- # & winrm.cmd set winrm/config '@{MaxTimeoutms="1800000"}' >> $logfile
- # & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile
- # & winrm.cmd set winrm/config/winrs '@{MaxShellsPerUser="50"}' >> $logfile
- # #Server settings - support username/password login
- # & winrm.cmd set winrm/config/service/auth '@{Basic="true"}' >> $logfile
- # & winrm.cmd set winrm/config/service '@{AllowUnencrypted="true"}' >> $logfile
- # & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile
- # #Firewall Config
- # & netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any >> $logfile
- # #Set script execution to unrestricted
- # & Set-ExecutionPolicy Unrestricted -Force
- # </powershell>
+
- name: windows-2012
driver:
image_search:
@@ -231,7 +221,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: administrator
- name: windows-2008r2
@@ -243,7 +232,6 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
transport:
username: administrator
#
@@ -258,7 +246,6 @@ platforms:
# virtualization-type: hvm
# block-device-mapping.volume-type: standard
# image-type: machine
- # instance_type: t2.micro
# transport:
# username: root
# - name: centos-6
@@ -270,7 +257,6 @@ platforms:
# virtualization-type: paravirtual
# block-device-mapping.volume-type: standard
# image-type: machine
- # instance_type: t1.micro
# transport:
# username: root
#
@@ -285,4 +271,34 @@ platforms:
virtualization-type: hvm
block-device-mapping.volume-type: gp2
image-type: machine
- instance_type: t2.micro
+
+suites:
+ - name: default
+ run_list:
+ - recipe[git]
+ attributes: {}
+ includes: ["ubuntu-14.04"]
+ excludes: ["windows-2012r2", "windows-2012", "windows-2008r2"]
+ - name: source
+ includes: ["nonexistent"]
+ excludes: ["ubuntu-12.04", "ubuntu-10.04", "windows-2012r2", "windows-2012", "windows-2008r2"]
+ run_list:
+ - recipe[git::source]
+ attributes: {}
+ - name: default-windows
+ includes: [
+ # 'windows-8.1-professional',
+ # 'windows-2008r2-standard',
+ "windows-2012r2",
+ # "windows-2012",
+ # "windows-2008r2"
+ ]
+ run_list:
+ - recipe[git]
+ attributes: {}
+
+provisioner:
+ name: chef_zero
+ product_name: chef
+ product_version: latest
+ channel: current