Skip to content

Commit

Permalink
refactoring unit_test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
irixjp committed Oct 8, 2018
1 parent 12a4692 commit cb29153
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions web_svr/tasks/unit_test.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
---
- name: Is httpd package installed?
shell: rpm -qa | grep httpd-
register: result_rpm
ignore_errors: yes
- ignore_errors: yes
block:
- name: Is httpd package installed?
shell: yum list installed | grep -e '^httpd\.'
register: result_rpm

- name: Is index.html is exist?
shell: test -e /var/www/html/index.html
register: result_file
ignore_errors: yes
- name: Is index.html present?
shell: test -e /var/www/html/index.html
register: result_file

- name: Is httpd processes are started?
shell: ps -ef | grep http[d]
register: result_proc
ignore_errors: yes
- name: Is httpd processe started?
shell: ps -ef | grep http[d]
register: result_proc

- name: Is port 80 is opened?
wait_for:
host: localhost
port: 80
timeout: 3
register: result_port
ignore_errors: yes
- name: Is httpd service enabled?
shell: systemctl is-enabled httpd
register: result_enabled

- name: Does the server return 200 OK?
uri:
url: http://localhost/
follow_redirects: none
status_code: 200
register: result_url
ignore_errors: yes
- name: Is port 80 opened?
wait_for:
host: localhost
port: 80
timeout: 3
register: result_port

- name: Does the server return 200 OK?
uri:
url: http://localhost/
follow_redirects: none
status_code: 200
register: result_url

- name: check test results
assert:
Expand All @@ -37,6 +38,7 @@
- "{{ result_rpm }}"
- "{{ result_file }}"
- "{{ result_proc }}"
- "{{ result_enabled }}"
- "{{ result_port }}"
- "{{ result_url }}"
loop_control:
Expand Down

0 comments on commit cb29153

Please sign in to comment.