Commit graph

84 commits

Author SHA1 Message Date
Laurent Indermuehle
994c6efab1
Use same variable as other target for consistency 2023-01-06 14:34:04 +01:00
Laurent Indermuehle
06ca921577
Cut useless task 2023-01-06 14:33:46 +01:00
Laurent Indermuehle
8d43f9e573
Refactor the way server_id is set for replicas
The simple way is to add '--server-id 2' after the name of the image of
the container. But GHA doesn't let us do that. The idea of mount a file
from our repo doesn't work because the repo is check out later in the
workflow and I failed to find a pre-job hook. Then I realized that this
MySQL option is dynamic! So we will set that in the test target!
2023-01-06 14:14:35 +01:00
Laurent Indermuehle
168de6bcfb
Cut unused file 2023-01-06 10:06:53 +01:00
Laurent Indermuehle
7ba0dbd7b9
lint 2023-01-06 10:06:46 +01:00
Laurent Indermuehle
192680888c
Fix trailing newline and quote in db_engine_version 2023-01-06 10:05:56 +01:00
Laurent Indermuehle
42fe4baf18
Fix tailing newline by not created it in the first place 2023-01-05 19:44:22 +01:00
Laurent Indermuehle
a271a9bcd2
Cut the newline added by lookup 'file' 2023-01-05 19:34:58 +01:00
Laurent Indermuehle
bc92ded791
Refactor test to use the db_version from setup_controller 2023-01-05 19:05:58 +01:00
Laurent Indermuehle
1de0f2ce77
Fix missing var 2023-01-05 19:05:02 +01:00
Laurent Indermuehle
98ce2af28c
Refactor way tests info are passed from sed to file with lookup
The idea is to avoid modifying test targets from the workflow to prevent
ansible-test to think every tests needs to be run.
2023-01-05 19:04:51 +01:00
Laurent Indermuehle
9da866a7bf
Refactor test_mysql_user to work with other host than localhost 2023-01-05 18:04:12 +01:00
Laurent Indermuehle
978676a6dc
Linting 2023-01-05 11:59:08 +01:00
Laurent Indermuehle
7cffcf3355
Add back a package to connect to MySQL 8+ 2023-01-05 11:56:11 +01:00
Laurent Indermuehle
2af8e4f273
Fix server_id in GHA
GHA lack a way to pass option to docker's command. Also server_id is
not read as a environment variable. So I'm forced to use a config file.
2023-01-05 11:55:54 +01:00
Laurent Indermuehle
9e3010dd00
Fix test_mysql_role 2023-01-04 18:02:39 +01:00
Laurent Indermuehle
7049a280cb
Refactor setup_mysql into setup_controller 2023-01-04 17:29:06 +01:00
Laurent Indermuehle
405b809a86
Linting 2023-01-04 17:17:53 +01:00
Laurent Indermuehle
1c863da888
Simplify version computation 2023-01-04 17:17:31 +01:00
Laurent Indermuehle
17f8ecef35
Fix replication due to usage of gateway_addr instead of localhost 2023-01-04 17:16:54 +01:00
Laurent Indermuehle
72b3ecb6da
Fix database not selected 2023-01-04 17:16:37 +01:00
Laurent Indermuehle
b821db97c5
Generalize mysql and mariadb version based on container name
This way we can split db_engine and db_version and simplify tests.
Also this is mandatory to use the matrix.db_engine_version as the
image name for our services containers.
2023-01-04 14:14:13 +01:00
Laurent Indermuehle
90266f1ad5
De-duplicate the mysql_command alias 2023-01-04 13:15:24 +01:00
Laurent Indermuehle
b72ca0d214
Prepare controller with Podman/Docker Network
We use the Podman/Docker network gateway address to communicate between
container. I haven't tested Docker. I would have preferred to use a pod
but only Podman support it and ansible-test only support the
--docker-network option.
2023-01-04 11:23:39 +01:00
Laurent Indermuehle
06666690eb
Fix package name and missing apt cache 2023-01-03 17:48:43 +01:00
Laurent Indermuehle
676509e88d
Install mysql_client the correct way 2023-01-03 15:17:47 +01:00
Laurent Indermühle
574fef5e50
Merge branch 'main' into lie_tests_using_containers 2022-12-09 15:33:33 +01:00
Laurent Indermuehle
eec9f972cc
Add path to default-file
/root doesn't exist with --venv
2022-12-09 15:22:41 +01:00
Laurent Indermuehle
01e664fb25
Fix comparison
We are not logged in as 127.0.0.1 anymore, but 10.88... as I couldn't
test this easily, I decided to simplify the test.
2022-12-09 15:22:41 +01:00
Laurent Indermuehle
c895a86c2a
Add % instead of the default 'localhost' since we use remote connection
Previously, everything was on localhost. Now ansible-test is in a
venv and the db is in a container. The db see the IP address from the
podman host (10.88.0.2)
2022-12-09 15:22:41 +01:00
Laurent Indermuehle
8c5806848f
Add default file for root necessary since using venv instead of docker 2022-12-09 15:22:41 +01:00
Laurent Indermuehle
86188a20aa
Draft: Add a mariadb container 2022-12-09 15:22:40 +01:00
Diego Gullo
6ac89ca1f6
Display a more informative error when InvalidPrivsError is raised (#465) (#466)
* Display a more informative error when InvalidPrivsError is raised (Issue #465)

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2022-12-06 13:12:01 +01:00
R.Sicart
2d75bc19b8
Fix privilege changing everytime (#438)
* Compare privileges from before and after manipulation

* Add unit tests

* Fix FIXME integration tests related to this issue

* Fix sanity check

* Fix assertion when appending privs in mysql_role_initial integration tests

* Fix pylint

* [ci-skip] Add changelog fragment

* Fix: missing fragment file extension

* Replace privileges_equal() by a comparison

* Fix: sanity pylint

* Fix: forgot to remove privileges_equal import from unit tests
2022-09-08 18:26:58 +02:00
R.Sicart
cc5cf98368
Fix: grant revoked priv (#434)
* Fix: exclude mysql 8 from test_mysql_user's 'Assert that priv did not change' test

* Add tests to verify that GRANT permission is present after user modification

* Fix: do not revoke GRANT permission when it's already allowed and present in priv parameter

* Deduplicate tests name

Easier to debug this way

* Fix assertions named 'GRANT permission is present'

* Only revoke grant option if it exists and absence is requested

* Fix assertion comments

* Fix: Only revoke grant option if it exists and absence is requested

* Avoid pointless revocations when ALL are granted

* Assert that priv did not change on mariadb also

* Fix: sanity and unity tests

* Format long lines

* Add changelog fragment

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2022-09-02 13:40:06 +02:00
Laurent Indermühle
0a68bb270f
Is changed (#427)
* Refactor tests to use "is" and "is not" changed

* Refactor tests to use is succeeded or is failed

* Reformat indentation

* Add filter "bool" to prevent issues
2022-08-23 09:11:55 +02:00
Laurent Indermühle
61586ae4cc
Port stable 1 ci changes (#423)
* Add changes from stable-1 integrations tests (PR 418)

* Refactor to use connectors' info declared in setup_mysql

* Fix 2nd replication stop marked changed by mysqlclient
2022-08-16 09:15:50 +02:00
Laurent Indermühle
5108ca5e66
Fix mysqldump ignoring errors (#403)
* Add schema and tables for the tests

* Add tests for full dump with and without compression

* Add test for distinct dump with and without compression

* Fix sh not seeing errors for command before the pipe

sh is missing the pipefail flag. We must use bash for this.

* Add cleanup to prevent the following tests from failing

* Fix fqcn in module_defaults

* Add changelog fragment

* Add check to the error message to ensure we captured the right one

* Add option to activate the fix on systems with bash

* Fix errors when data schema is already absent

* Update changelogs/fragments/fix-256-mysql_dump-errors.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Add markup for commands in the documentation string

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Add markup and next release version in the documentation string

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Fix missing dependency for MySQL 8

* Add pipefail to tests of uncompressed dumps to enure it still works

* Fix "bash command not found" if pipefail is used for uncompressed dump

* Fix sanity pep8

* Document example of dump with pipefail

* Add dedpulication to command construct

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-06-30 06:54:26 +02:00
Andrew Klychkov
b62a59cf5a
Update mariadb to 10.6.8 in test matrix (#370)
* Update mariadb to 10.6.8 in test matrix

* try 10.8.3

* change tarball path

* Change tarball name

* Add mariadb 10.8

* Fix

* Fix

* Fix
2022-06-24 13:50:19 +02:00
Andrew Klychkov
04aa13f6d6
mysql_replication: set MASTER_SSL=0 when primary_ssl is set to no (#397)
* mysql_replication: set MASTER_SSL=0 when primary_ssl is set to no

* Improve doc
2022-06-13 08:13:58 +02:00
Andrew Klychkov
8e79690a02
mysql_db: add chdir argument (#396) 2022-06-13 08:11:18 +02:00
betanummeric
ed3935abec
mysql_user: add "update_password: on_new_username" argument, "password_changed" result field (#365)
* mysql_user: add value 'on_new_username' to argument 'update_password'

* mysql_user: return "password_changed" boolean (true if the user got a new password)

* mysql_user: optimize queries for existing passwords

* mysql_user: add integration tests for update_password argument

* mysql_user: add description for "update_password: on_new_username" argument

* add changelog fragment

* formatting (PEP8)

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-31 16:00:24 +02:00
betanummeric
bf5086d19d
mysql_role: add argument "members_must_exist" (#369)
* mysql_role: add argument "members_must_exist" (boolean, default true)

The assertion that the users supplied in the "members" argument exist is only executed when the new argument "members_must_exist" is true, to allow opt-out.

* mysql_role: add integration tests for argument members_must_exist

* add changelog fragment

* mysql_role: fix behavior of members_must_exist argument

* Update plugins/modules/mysql_role.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/369_mysql_role-add-members_must_exist.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-27 12:11:17 +02:00
Andrew Klychkov
647461010d
mysql_query: fix false change reports when IF NOT EXISTS clause is used (#322)
* mysql_query: fix false change reports when IF NOT EXISTS clause is used

* Fix

* Fix doc, add fragment

* Improve doc
2022-05-25 16:19:31 +02:00
betanummeric
ceda7662d0
mysql_role: don't add members to a role when creating the role and "detach_members: true" is set (#367)
* mysql_role: don't add members to a role when creating the role and "detach_members: true" is set, add integration test

* add changelog fragment

* mysql_role: add author betanummeric

* Update changelogs/fragments/367-mysql_role-fix-deatch-members.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-25 11:47:39 +02:00
Andrew Klychkov
8d114c7e39
mysql_user: fix parsing privs when a user has roles assigned to it (#341)
* mysql_user: fix parsing errors when a user has roles assigned

* Add a changelog fragment

* Fix a typo

* Fix CI
2022-05-12 09:36:21 +02:00
betanummeric
ba4fea67b1
mysql_user, mysql_role: add argument subtract_privs to revoke privileges explicitly (#333)
* add option subtract_privs to mysql_role and mysql_user

see https://github.com/ansible-collections/community.mysql/issues/331

* add integration tests for subtract_privs for mysql_role and mysql_user

* add changelog fragment for PR #333

* mysql_role, mysql_user: when subtract_privileges, don't grant unwanted privileges and don't revoke USAGE implicitly

* fix integration tests

* mysql_role, mysql_user: invalid privileges are ignored when subtract_privs is true -> document that and fix integration tests

* fix mysql_role integration tests

* fix mysql_role, mysql_user integration tests

* formatting

make the PEP8 check happy

* mysql_user and mysql_role: fix granting privileges when only the GRANT OPTION needs to be added

* mysql_user and mysql_role: log some updated privileges; explain integration test blind spot

* mysql_user and mysql_role: don't grant too much privileges

If only the grant option needs to be granted, at least one privilege needs to be granted to get valid syntax. USAGE is better for that than the existing privileges, because unwanted privileges would be re-added after revokation.

* mysql_user and mysql_role: fix type error

* Update changelogs/fragments/333-mysql_user-mysql_role-add-subtract_privileges-argument.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/mysql_role.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-09 09:50:49 +02:00
Andrew Klychkov
450cb19027
mysql_replication: fix failing when using primary_use_gtid with replica_ or slave_pos (#336) 2022-04-21 17:43:08 +02:00
R.Sicart
82cedf8510
Fix role integration tests for mariadb (#291)
* Fix: test_mysql_role : Check that the user have no active roles assertion

* Fix: test_mysql_role : Check in DB assertion

* Fix: test_mysql_role : Check in DB, if not granted, the query will fail for mariadb

* Fix: test_mysql_role : Check that the role is active assertion

* test_mysql_role : create checks for mariadb

* Make 'when' conditions uniform

* Fix: test_mysql_role : admin option tests

* test_mysql_role : create checks for mariadb

* Fix: add fixme on test which create role in check mode 'again'

It changes only on mariadb 10.2
(doesn't change on mysql 8 or mariadb 10.5)

* Fix: add fixme on test which create role 'again'

* Simplify test without checking Host part

* Fix 'show grant' checks for mariadb

* Enable mariadb tests for test_mysql_role target

* Add tests to verify role grants for roles

* Add FIXME comments for tests which do not pass on mariadb 10.2

* Fix FIXME tests related to mariadb 10.2

* Exclude mysqlclient==2.0.1 with mariadb from integration tests
2022-03-04 10:52:43 +01:00
Andrew Klychkov
c273ee36a7
Enable and fix integration tests for devel (#290)
* Enable and fix integration tests for devel

* Update repo targets

* Remove useless directive

* default container -> ubuntu1804

* revert last commit

* 10.2 does not support 20.04 focal; increase to 10.3
2022-03-01 17:57:20 +01:00