forked from ansible-collections/community.mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mysql_info - Add connector_name and connector_version to returned val…
…ue (ansible-collections#497) * Add methods to retrieve connector name and version * Document that mysqlclient is also named MySQLdb * Document version_added * Add connector name and version in the returned block * Cut condition to display any name that is return In case of MySQLdb is renamed in mysqlclient. In that case, the integration tests will catch this the day we update the connector version. Co-authored-by: Andrew Klychkov <[email protected]>
- Loading branch information
1 parent
3229ce4
commit a5f3296
Showing
5 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
changelogs/fragments/497_mysql_info_returns_connector_name_and_version.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
minor_changes: | ||
- mysql_info - add ``connector_name`` and ``connector_version`` to returned values (https://github.com/ansible-collections/community.mysql/pull/497). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/integration/targets/test_mysql_info/tasks/connector_info.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
# Added in 3.6.0 in | ||
# https://github.com/ansible-collections/community.mysql/pull/497 | ||
|
||
# TODO: Refactor in PR490. | ||
- name: Connector info | Assert connector_name exists and has expected values | ||
ansible.builtin.assert: | ||
that: | ||
- result.connector_name is defined | ||
- result.connector_name is in ['pymysql', 'MySQLdb'] | ||
success_msg: >- | ||
Assertions passed, result.connector_name is {{ result.connector_name }} | ||
fail_msg: >- | ||
Assertion failed, result.connector_name is | ||
{{ result.connector_name | d('Unknown')}} which is different than expected | ||
pymysql or MySQLdb | ||
# TODO: Refactor in PR490. | ||
- name: Connector info | Assert connector_version exists and has expected values | ||
ansible.builtin.assert: | ||
that: | ||
- result.connector_version is defined | ||
- > | ||
result.connector_version == 'Unknown' | ||
or result.connector_version is version(connector_ver, '==') | ||
success_msg: >- | ||
Assertions passed, result.connector_version is | ||
{{ result.connector_version }} | ||
fail_msg: >- | ||
Assertion failed, result.connector_version is | ||
{{ result.connector_version }} which is different than expected | ||
{{ connector_ver }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters