File tree Expand file tree Collapse file tree 2 files changed +33
-19
lines changed
Expand file tree Collapse file tree 2 files changed +33
-19
lines changed Original file line number Diff line number Diff line change 44 gather_facts : True
55 become : True
66 connection : " {{ kitchen_connection | default('local') }}"
7+ pre_tasks :
8+ - name : update apt
9+ apt : update_cache=yes cache_valid_time=3600
10+
11+ - name : One time tasks for testing
12+ shell : " mkdir -p /etc/nginx/sites-enabled/ && touch /etc/nginx/sites-enabled/remove_me.conf && touch /tmp/creates"
13+ args :
14+ creates : /tmp/creates
15+
16+ - name : Create dir for content
17+ file :
18+ path="/nginx/{{ item }}"
19+ state=directory
20+ mode=0755
21+ with_items :
22+ - test2
23+ - test3
24+
25+ - name : Create content for test
26+ copy :
27+ content="Hello {{ item }}"
28+ dest="/nginx/{{ item }}/index.html"
29+ mode=0644
30+ with_items :
31+ - test2
32+ - test3
33+
734 vars :
835 nginx_manage_sites : True
936 nginx_site :
1845 name : /,
1946 type : location,
2047 try_files : " $uri $uri/ =404" ,
21- root : " {{ nginx_default_root }} "
48+ root : " /nginx/test2 "
2249 }
2350
2451 - file_name : " test3"
3259 name : /,
3360 type : location,
3461 try_files : " $uri $uri/ =404" ,
35- root : " {{ nginx_default_root }} "
62+ root : " /nginx/test3 "
3663 }
37- pre_tasks :
38- - name : update apt
39- apt : update_cache=yes cache_valid_time=3600
4064
41- - name : One time tasks for testing
42- shell : " mkdir -p /etc/nginx/sites-enabled/ && touch /etc/nginx/sites-enabled/remove_me.conf && touch /tmp/creates"
43- args :
44- creates : /tmp/creates
4565 roles :
4666 - " ansible-nginx"
4767
Original file line number Diff line number Diff line change 4848
4949describe 'NGinx http content' do
5050
51- describe command "curl -s -L http://127.0.0.1:1180 | grep h1 " do
51+ describe command "curl -s -L http://127.0.0.1:1180" do
5252 its ( :exit_status ) { should eq 0 }
53- its ( :stdout ) { should match "<h1>Welcome to nginx!</h1> " }
53+ its ( :stdout ) { should match "Hello test2 " }
5454 end
5555
56- describe command "curl -s -L http://127.0.0.1:1280 | grep h1 " do
56+ describe command "curl -s -L http://127.0.0.1:1280" do
5757 its ( :exit_status ) { should eq 0 }
58- its ( :stdout ) { should match "<h1>Welcome to nginx!</h1>" }
59- end
60-
61- describe command "cat /var/log/nginx/*" do
62- its ( :exit_status ) { should eq 0 }
63- its ( :stdout ) { should match "XXXXXXXX" }
58+ its ( :stdout ) { should match "Hello test3" }
6459 end
6560
6661end
67-
You can’t perform that action at this time.
0 commit comments