Skip to content

Commit b5ee17b

Browse files
committed
test preparation
1 parent 629874e commit b5ee17b

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

.kitchen.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
driver :
3+
# TRAVIS: local
4+
# NO TRAVIS: vagrant
5+
name : <%= if ENV['TRAVIS'] then 'localhost' else 'vagrant' end %>
6+
7+
provisioner:
8+
name : ansible_push
9+
verbose : "vvvv"
10+
ansible_config : "tests/ansible.cfg"
11+
idempotency_test : True
12+
# TRAVIS: True
13+
# NO TRAVIS: False
14+
sudo : <%= if ENV['TRAVIS'] then 'True' else 'False' end %>
15+
16+
platforms:
17+
# travistravis
18+
- name : <%= if ENV['TRAVIS'] then 'travis' else 'ubuntu-14.04' end %>
19+
provisioner :
20+
raw_arguments : <%= if ENV['TRAVIS'] then '-c local' else '' end %>
21+
# Should be safily ignored by Travis since connection local
22+
driver :
23+
box : ubuntu/trusty64
24+
customize :
25+
cpus : 2
26+
memory : 2048
27+
28+
suites:
29+
- name : simple
30+
provisioner :
31+
playbook : "tests/application/simple.yml"
32+
extra_vars : { 'kitchen_connection': 'smart', 'kitchen_hosts': '<%= if ENV['TRAVIS'] then 'localhost' else 'all' end %>' }
33+

Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source 'https://rubygems.org'
2+
3+
4+
group :development do
5+
gem 'test-kitchen'
6+
gem 'kitchen-vagrant'
7+
gem 'kitchen-ansiblepush'
8+
gem 'kitchen-localhost'
9+
end

tests/ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
roles_path=../:../../:/spec/

tests/application/simple.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
- name : Simple
3+
hosts : "{{ kitchen_hosts }}"
4+
gather_facts : true
5+
sudo : True
6+
connection : "{{ kitchen_connection | default('local') }}"
7+
vars :
8+
nginx_site :
9+
- file_name : "test"
10+
blocks :
11+
- type : "server"
12+
index : "index.htm index.htm"
13+
server_name : localhost
14+
listen : 1080
15+
## Use josn
16+
location1 : {
17+
name: /,
18+
type: location,
19+
try_files: "$uri $uri/ /index.html",
20+
root: "{{ nginx_default_root }}"
21+
}
22+
## Use yaml
23+
location2 :
24+
name : /doc/
25+
type : location
26+
alias : "/usr/share/doc/"
27+
autoindex : "on"
28+
allow : "127.0.0.2"
29+
deny : "all"
30+
31+
roles :
32+
- "ansible-nginx"
33+

0 commit comments

Comments
 (0)