Browse Source

revert integration test (#55)

local_integrationtest
Markus Bergholz 11 months ago committed by GitHub
parent
commit
d85c88619d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .github/workflows/ansible-test-plugins.yml
  2. 92
      tests/integration/targets/localhost.yml
  3. 5
      tests/integration/targets/setup_proxysql/tasks/main.yml

3
.github/workflows/ansible-test-plugins.yml

@ -80,9 +80,6 @@ jobs:
- name: Set ProxySQL version (${{ matrix.proxysql }})
run: "sed -i 's/^proxysql_version:.*/proxysql_version: \"${{ matrix.proxysql }}\"/g' ${{ env.proxysql_version_file }}"
- name: install python3-apt to detect of proxysql is already available
run: sudo apt install python3-apt -y
- name: Run integration tests
run: ansible-test integration --docker -v --color --retry-on-error --continue-on-error --python ${{ matrix.python }} --diff --coverage
working-directory: ./ansible_collections/community/proxysql

92
tests/integration/targets/localhost.yml

@ -1,92 +0,0 @@
---
- name: >
start proxysql container
requires docker sdk and docker daemon
--extra-vars "PROXYSQL_VERSION=2.0.18"
--extra-vars "mysql_connector=mysqlclient"
hosts: localhost
connection: local
tasks:
- name: >
start proxysql container for integration tests
community.docker.docker_container:
name: proxysql
image: "proxysql/proxysql:{{ PROXYSQL_VERSION | default('2.2.0') }}"
state: started
auto_remove: yes
recreate: yes
container_default_behavior: no_defaults
- name: add proxysql container temporary host group testing
add_host: hostname=proxysql groups=testing
- name: >
prepare proxysql container
basically installing requirements that are missing
in the official proxysql base image
currently it based on debian stretch
run integration tests against local proxysql container
changes on modules must be build and installed with ansible-galaxy
hosts: testing
connection: docker
vars:
ansible_python_interpreter: /usr/bin/python3
mysql_connector: pymysql
tasks:
- name: install pymysql requirements in docker container
when: "mysql_connector == 'pymysql'"
apt:
name:
- python3-pymysql
- python3-apt
- mysql-client
state: present
update_cache: yes
- name: install mysqlclient requirements in docker container
when: "mysql_connector == 'mysqlclient'"
block:
- name: apt packages
apt:
name:
- python3-apt
- mysql-client
- python3-dev
- default-libmysqlclient-dev
- build-essential
- python3-pip
state: present
update_cache: yes
- name: install mysqlclient
pip:
name: mysqlclient
- name: include roles for integrationtest itself
include_role:
name: "{{ item }}"
with_items:
- test_proxysql_backend_servers
- test_proxysql_global_variables
- test_proxysql_mysql_users
- test_proxysql_query_rules
- test_proxysql_query_rules_fast_routing
- test_proxysql_replication_hostgroups
- test_proxysql_scheduler
- name: >
stop docker container / clean up local environment
hosts: localhost
connection: local
tasks:
- name: stop proxysql container
community.docker.docker_container:
name: proxysql
state: stopped
container_default_behavior: no_defaults

5
tests/integration/targets/setup_proxysql/tasks/main.yml

@ -3,12 +3,7 @@
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Gather the package facts
ansible.builtin.package_facts:
manager: apt
- name: install and configure proxysql only if not exists
when: ansible_facts.packages['proxysql'] is not defined
block:
- import_tasks: install.yml
- import_tasks: config.yml

Loading…
Cancel
Save