diff --git a/.github/workflows/ansible-test-plugins.yml b/.github/workflows/ansible-test-plugins.yml index 7587137..275464d 100644 --- a/.github/workflows/ansible-test-plugins.yml +++ b/.github/workflows/ansible-test-plugins.yml @@ -1,38 +1,38 @@ --- name: Plugins CI on: - push: - paths: - - 'plugins/**' - - 'tests/**' - - '.github/workflows/ansible-test-plugins.yml' + # push: + # paths: + # - 'plugins/**' + # - 'tests/**' + # - '.github/workflows/ansible-test-plugins.yml' pull_request: paths: - 'plugins/**' - 'tests/**' - '.github/workflows/ansible-test-plugins.yml' - schedule: - - cron: '0 6 * * *' + # schedule: + # - cron: '0 6 * * *' jobs: - sanity: - name: "Sanity (Ansible: ${{ matrix.ansible }})" - runs-on: ubuntu-20.04 - strategy: - matrix: - ansible: - - stable-2.12 - - stable-2.13 - - stable-2.14 - - devel - steps: - - name: Perform sanity testing - uses: ansible-community/ansible-test-gh-action@release/v1 - with: - ansible-core-version: ${{ matrix.ansible }} - testing-type: sanity - pull-request-change-detection: true + # sanity: + # name: "Sanity (Ansible: ${{ matrix.ansible }})" + # runs-on: ubuntu-20.04 + # strategy: + # matrix: + # ansible: + # - stable-2.12 + # - stable-2.13 + # - stable-2.14 + # - devel + # steps: + # - name: Perform sanity testing + # uses: ansible-community/ansible-test-gh-action@release/v1 + # with: + # ansible-core-version: ${{ matrix.ansible }} + # testing-type: sanity + # pull-request-change-detection: true integration: name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, MySQL: ${{ matrix.db_engine_version }}, Connector: ${{ matrix.connector }})" @@ -42,20 +42,20 @@ jobs: matrix: db_engine_version: - mysql:5.7.40 - - mysql:8.0.31 - - mariadb:10.4.24 - - mariadb:10.5.18 - - mariadb:10.6.11 - - mariadb:10.7.7 - - mariadb:10.8.3 + # - mysql:8.0.31 + # - mariadb:10.4.24 + # - mariadb:10.5.18 + # - mariadb:10.6.11 + # - mariadb:10.7.7 + # - mariadb:10.8.3 ansible: - - stable-2.12 - - stable-2.13 + # - stable-2.12 + # - stable-2.13 - stable-2.14 - - devel + # - devel python: - - 3.8 - - 3.9 + # - 3.8 + # - 3.9 - 3.10 connector: - pymysql==0.7.10 @@ -128,6 +128,15 @@ jobs: steps: + - name: Set MySQL server for replication + run: | + docker exec ${{ job.services.db_primary.id }} sh -c 'echo [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf' + docker exec ${{ job.services.db_replica1.id }} sh -c 'echo [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf' + docker exec ${{ job.services.db_replica2.id }} sh -c 'echo [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf' + docker restart ${{ job.services.db_primary.id }} + docker restart ${{ job.services.db_replica1.id }} + docker restart ${{ job.services.db_replica2.id }} + - name: >- Perform integration testing against Ansible version ${{ matrix.ansible }} @@ -143,39 +152,39 @@ jobs: target-python-version: ${{ matrix.python }} testing-type: integration - units: - runs-on: ubuntu-20.04 - name: Units (Ⓐ${{ matrix.ansible }}) - strategy: - # As soon as the first unit test fails, - # cancel the others to free up the CI queue - fail-fast: true - matrix: - ansible: - - stable-2.12 - - stable-2.13 - - stable-2.14 - - devel - python: - - 3.8 - - 3.9 - exclude: - - python: 3.8 - ansible: stable-2.13 - - python: 3.8 - ansible: stable-2.14 - - python: 3.8 - ansible: devel - - python: 3.9 - ansible: stable-2.12 + # units: + # runs-on: ubuntu-20.04 + # name: Units (Ⓐ${{ matrix.ansible }}) + # strategy: + # # As soon as the first unit test fails, + # # cancel the others to free up the CI queue + # fail-fast: true + # matrix: + # ansible: + # - stable-2.12 + # - stable-2.13 + # - stable-2.14 + # - devel + # python: + # - 3.8 + # - 3.9 + # exclude: + # - python: 3.8 + # ansible: stable-2.13 + # - python: 3.8 + # ansible: stable-2.14 + # - python: 3.8 + # ansible: devel + # - python: 3.9 + # ansible: stable-2.12 - steps: - - name: >- - Perform unit testing against - Ansible version ${{ matrix.ansible }} - uses: ansible-community/ansible-test-gh-action@release/v1 - with: - ansible-core-version: ${{ matrix.ansible }} - target-python-version: ${{ matrix.python }} - testing-type: units - pull-request-change-detection: true + # steps: + # - name: >- + # Perform unit testing against + # Ansible version ${{ matrix.ansible }} + # uses: ansible-community/ansible-test-gh-action@release/v1 + # with: + # ansible-core-version: ${{ matrix.ansible }} + # target-python-version: ${{ matrix.python }} + # testing-type: units + # pull-request-change-detection: true diff --git a/Makefile b/Makefile index c416469..c38423b 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ test-integration: --network podman \ --publish 3307:3306 \ --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ - $(db_engine_version) + $(db_engine_version) \ + mysqld --server-id 1 --log-bin=/var/lib/mysql/primary-bin podman run \ --detach \ --name replica1 \ @@ -19,7 +20,8 @@ test-integration: --network podman \ --publish 3308:3306 \ --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ - $(db_engine_version) + $(db_engine_version) \ + mysqld --server-id 2 --log-bin=/var/lib/mysql/replica1-bin podman run \ --detach \ --name replica2 \ @@ -28,7 +30,8 @@ test-integration: --network podman \ --publish 3309:3306 \ --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ - $(db_engine_version) + $(db_engine_version) \ + mysqld --server-id 3 --log-bin=/var/lib/mysql/replica2-bin while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done -set -x; ansible-test integration -v --color --coverage --retry-on-error --continue-on-error --diff --docker --docker-network podman --python $(python); set +x rm tests/integration/db_engine_version diff --git a/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml b/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml index af305e2..900fd68 100644 --- a/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml +++ b/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml @@ -19,21 +19,6 @@ - db_engine == 'mysql' - db_version is version('8.0.22', '>=') - # We can't pass --server-id to service containers in GHA - - name: Change replica1 server_id to 2 - mysql_variables: - <<: *mysql_params - login_port: '{{ mysql_replica1_port }}' - variable: server_id - value: 2 - - - name: Change replica2 server_id to 3 - mysql_variables: - <<: *mysql_params - login_port: '{{ mysql_replica2_port }}' - variable: server_id - value: 3 - # We use iF NOT EXISTS because the GITHUB Action: # "ansible-community/ansible-test-gh-action" uses "--retry-on-error". # If test_mysql_replication fails, test will run again an without the IF