Skip to content

Commit

Permalink
Merge pull request #2 from Oefenweb/improved-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten authored May 17, 2018
2 parents 62145c9 + f07024c commit 21cd430
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
26 changes: 26 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,29 @@
- configuration
- tinyproxy
- tinyproxy-configuration

- name: start and enable service
service:
name: tinyproxy
state: "{{ service_default_state | default('started') }}"
enabled: "{{ service_default_enabled | default(true) | bool }}"
when: ansible_service_mgr == 'systemd'
tags:
- configuration
- tinyproxy
- tinyproxy-start-enable-service
- tinyproxy-start-enable-service-systemd

# TODO: Remove when support for Ubuntu 14.04 is dropped
- name: start and enable service
service:
name: tinyproxy
state: "{{ service_default_state | default('started') }}"
enabled: "{{ service_default_enabled | default(true) | bool }}"
pattern: /usr/sbin/tinyproxy
when: ansible_service_mgr != 'systemd'
tags:
- configuration
- tinyproxy
- tinyproxy-start-enable-service
- tinyproxy-start-enable-service-initd
16 changes: 16 additions & 0 deletions tests/post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# post test file for tinyproxy
---
- name: post | install dependencies
apt:
name: "{{ item }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
with_items:
- curl

- name: post | test installation
command: curl -s --head https://www.google.com --proxy http://127.0.0.1:3128
register: _result
changed_when: false
failed_when: _result.stdout.find('HTTP/1.0 200') == -1
5 changes: 3 additions & 2 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
become: true
roles:
- ../../
post_tasks:
- include: post.yml
vars:
tinyproxy_tinyproxy_conf:
- |
Expand All @@ -31,5 +33,4 @@
{% endfor %}
tinyproxy_port: 3128
tinyproxy_allow:
- "{{ ansible_lo['ipv4']['address'] }}"
- "{{ ansible_default_ipv4['address'] }}"
- 127.0.0.1
2 changes: 2 additions & 0 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
become: true
roles:
- ../../
post_tasks:
- include: post.yml
vars:
tinyproxy_port: 3128
tinyproxy_allow:
Expand Down

0 comments on commit 21cd430

Please sign in to comment.