-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added kitchen testing, reorganized resource teseting
- Loading branch information
Showing
23 changed files
with
200 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
source "https://supermarket.chef.io" | ||
|
||
metadata | ||
|
||
group :integration do | ||
cookbook 'test', :path => './test/fixtures/cookbooks/test' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
test CHANGELOG | ||
============== | ||
|
||
This file is used to list changes made in each version of the test cookbook. | ||
|
||
0.1.0 | ||
----- | ||
- [your_name] - Initial release of test | ||
|
||
- - - | ||
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. | ||
|
||
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cookbook to test parent |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name 'test' | ||
maintainer 'YOUR_COMPANY_NAME' | ||
maintainer_email 'YOUR_EMAIL' | ||
license 'All rights reserved' | ||
description 'Installs/Configures test' | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version '0.1.0' | ||
|
||
depends 'mysql', ">= 6.0" | ||
depends 's3_backup' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Cookbook Name:: test | ||
# Recipe:: default | ||
# | ||
# Copyright 2015, YOUR_COMPANY_NAME | ||
# | ||
# All rights reserved - Do Not Redistribute | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Cookbook Name:: | ||
# Recipe:: | ||
# | ||
# Copyright 2014, YOUR_COMPANY_NAME | ||
# | ||
# All rights reserved - Do Not Redistribute | ||
# | ||
|
||
# for test kitchen run to check out the whole shebang | ||
|
||
|
||
# create some file assets | ||
directory '/some' do | ||
mode '777' | ||
action :create | ||
end | ||
file '/some/file' do | ||
mode '777' | ||
content 'some test' | ||
action :create | ||
end | ||
|
||
directory '/another' do | ||
mode '777' | ||
action :create | ||
end | ||
file '/another/file' do | ||
mode '777' | ||
content 'another test' | ||
action :create | ||
end | ||
|
||
soon = Time.now + 60 | ||
soon_cron = {day: "#{soon.day}", hour: "#{soon.hour}", minute: "#{soon.min}"} | ||
s3_file_backup 'my_file_backup' do | ||
s3_region node['test_s3_region'] | ||
s3_bucket node['test_s3_bucket'] | ||
s3_access_key_id node['test_s3_access_key_id'] | ||
s3_secret_access_key node['test_s3_secret_access_key'] | ||
assets [ | ||
{'item' => '/some/file'}, | ||
{'item' => '/another/file', 'prefix' => 'another'} | ||
] | ||
groups ['group1', 'group2'] | ||
cron soon_cron | ||
log_success_message "file test works!" | ||
action :create | ||
end |
58 changes: 58 additions & 0 deletions
58
test/fixtures/cookbooks/test/recipes/kitchen_mysql_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Cookbook Name:: | ||
# Recipe:: | ||
# | ||
# Copyright 2014, YOUR_COMPANY_NAME | ||
# | ||
# All rights reserved - Do Not Redistribute | ||
# | ||
# required service | ||
|
||
mysql2_chef_gem 'default' # denote default version for this platform | ||
|
||
connection = {username: 'root', password: 'root_pw', socket: '/var/run/mysql-default/mysqld.sock'} | ||
|
||
mysql_service 'default' do | ||
socket connection[:socket] | ||
initial_root_password connection[:password] | ||
action [:create, :start] | ||
end | ||
|
||
mysql_database 'db1' do | ||
connection connection | ||
action :create | ||
end | ||
mysql_database 'db2' do | ||
connection connection | ||
action :create | ||
end | ||
# must use "db.table" form due to bug in database cookbook that fails to set database | ||
mysql_database 'create db1.table1' do | ||
connection connection | ||
sql "CREATE TABLE IF NOT EXISTS db2.table1 (id INT);" | ||
action [:query] | ||
end | ||
mysql_database 'create db1.table2' do | ||
connection connection | ||
sql "CREATE TABLE IF NOT EXISTS db2.table2 (id INT);" | ||
action [:query] | ||
end | ||
|
||
soon = Time.now + 90 # set the cron for +90 seconds... may not be enough on slow converge | ||
soon_cron = {day: "#{soon.day}", hour: "#{soon.hour}", minute: "#{soon.min}"} | ||
s3_mysql_backup 'my_mysql_backup' do | ||
mysql_connection connection | ||
mysql_user 'user1' | ||
mysql_password 'user1_pw' | ||
s3_region node['test_s3_region'] | ||
s3_bucket node['test_s3_bucket'] | ||
s3_access_key_id node['test_s3_access_key_id'] | ||
s3_secret_access_key node['test_s3_secret_access_key'] | ||
assets [ | ||
{'item' => 'db1'}, | ||
{'item' => 'db2 table2', 'prefix' => 'another'} | ||
] | ||
groups ['group1', 'group2'] | ||
cron soon_cron | ||
log_success_message "mysql test works!" | ||
action :create | ||
end |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bats | ||
|
||
fixtures bats | ||
|
||
@test "Test the backup scripts with real S3 access" { | ||
skip "sometime, when we figure out how to do this without exposing credentials." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
. /Volumes/RNRSecure/env_scripts/s3_test.sh | ||
kitchen $* |