From 0415357ede1fc2f2e1ebd543a96551fcd8a046fe Mon Sep 17 00:00:00 2001 From: Paul B Date: Wed, 6 May 2020 17:04:20 +0200 Subject: tests: running tests on all supported PG versions --- test/main.yml | 32 +++++++++++++++++--------------- test/requirements.txt | 3 ++- test/requirements.yml | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/main.yml b/test/main.yml index a4834be..6a819d8 100644 --- a/test/main.yml +++ b/test/main.yml @@ -2,8 +2,7 @@ - name: Bring up docker containers hosts: localhost vars: &common_vars - postgres_version: 11 - postgres_barman_directory: 'test-postgres-11' + postgres_barman_directory: "test-postgres-{{ postgres_version }}" postgres_barman_server: postgres_barman barman_rsync_password: "secret_rsync" barman_rsync_allowed_hosts: 172.17.0.0/24 @@ -15,25 +14,28 @@ range: 172.17.0.0/24 inventory: - name: "{{ postgres_barman_server }}" - image: "python:3.7-stretch" + image: "python:3.7-{{ debian_release }}" - name: postgres_one - image: "python:3.7-stretch" + image: "python:3.7-{{ debian_release }}" links: - "{{ postgres_barman_server }}" - name: postgres_two - image: "python:3.7-stretch" + image: "python:3.7-{{ debian_release }}" links: - "{{ postgres_barman_server }}" - postgres_one - name: postgres_three - image: "python:3.7-stretch" + image: "python:3.7-{{ debian_release }}" links: - "{{ postgres_barman_server }}" - postgres_one roles: - role: provision_docker - provision_docker_inventory: "{{inventory}}" - provision_docker_use_docker_connection: true + vars: + provision_docker_inventory: "{{inventory}}" + provision_docker_use_docker_connection: true + ansible_connection: local + ansible_python_interpreter: "{{ansible_playbook_python}}" tasks: - name: Group primary add_host: @@ -63,7 +65,7 @@ extensions: - description: PostGis apt_deps: - - "postgresql-{{ postgres_version }}-postgis" + - "postgresql-{{ postgres_version }}-postgis-3" names: - postgis - postgis_topology @@ -129,13 +131,13 @@ hosts: primary:secondary connection: docker vars: - postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}" + postgres_listen_addresses: ["{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"] pre_tasks: &pre_tasks - - name: "Build hosts file" - shell: 'echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }} {{inventory_hostname}}" >> /etc/hosts' - when: hostvars[inventory_hostname].ansible_default_ipv4.address is defined + - name: "Build hosts file" + shell: 'echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }} {{inventory_hostname}}" >> /etc/hosts' + when: hostvars[inventory_hostname].ansible_default_ipv4.address is defined - - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})" + - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})" roles: - { role: ansible-postgresql-role, tags: ['postgres'] } tasks: @@ -161,7 +163,7 @@ connection: docker hosts: primary:secondary vars: - postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}" + postgres_listen_addresses: ["{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"] pre_tasks: *pre_tasks roles: - { role: ansible-postgresql-role, tags: ['postgres'] } diff --git a/test/requirements.txt b/test/requirements.txt index d2cbb1a..3dfa5a6 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1 +1,2 @@ -docker-py +ansible +docker diff --git a/test/requirements.yml b/test/requirements.yml index f9d7099..7c41335 100644 --- a/test/requirements.yml +++ b/test/requirements.yml @@ -1,6 +1,6 @@ - src: chrismeyersfsu.provision_docker name: provision_docker - version: 7a6243dfcf69f9d262877eca487bc14b62ba6960 + version: d68ce0aa486eff7669011ee2f9eaf68b95184ce1 - src: trainline-eu.ansible_barman_role name: barman version: 1.1.0 -- cgit v1.2.3