mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-18 09:51:41 +00:00
* etcd3: re-enable and fix tests, add unit tests - Add unit tests for community.general.etcd3 module (12 tests covering state=present/absent, idempotency, check mode, and error paths) - Fix integration test setup: update etcd binary to v3.6.9 (from v3.2.14), download from GitHub releases, add health-check retry loop after start - Work around etcd3 Python library incompatibility with protobuf >= 4.x by setting PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python - Update to FQCNs throughout integration tests - Re-enable both etcd3 and lookup_etcd3 integration targets Fixes https://github.com/ansible-collections/community.general/issues/322 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * improve use of multiple context managers --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
---
|
|
# test code for the etcd3 module
|
|
# Copyright (c) 2017, Jean-Philippe Evrard <jean-philippe@evrard.me>
|
|
# Copyright (c) 2020, SCC France, Eric Belhomme <ebelhomme@fr.scc.com>
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# The etcd3 Python library uses protobuf-generated code that is incompatible
|
|
# with protobuf >= 4.x unless the pure-Python implementation is selected.
|
|
- environment:
|
|
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
|
|
block:
|
|
- name: Check mode, show need change
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "bar"
|
|
state: "present"
|
|
register: _etcd3_prst_chktst
|
|
check_mode: true
|
|
|
|
- name: Change to new value
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "bar"
|
|
state: "present"
|
|
register: _etcd3_prst_chgtst
|
|
|
|
- name: Idempotency test, show unchanged
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "bar"
|
|
state: "present"
|
|
register: _etcd3_prst_idmptnttst
|
|
|
|
- name: Idempotency test in check mode, show unchanged
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "bar"
|
|
state: "present"
|
|
register: _etcd3_prst_idmptntchktst
|
|
check_mode: true
|
|
|
|
- name: Check mode, show need removal of key
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "baz"
|
|
state: "absent"
|
|
register: _etcd3_absnt_chktst
|
|
check_mode: true
|
|
|
|
- name: Remove foo key
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "baz"
|
|
state: "absent"
|
|
register: _etcd3_absnt_chgtst
|
|
|
|
- name: Idempotency test in check mode, show unchanged
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "baz"
|
|
state: "absent"
|
|
register: _etcd3_absnt_idmptnttst
|
|
check_mode: true
|
|
|
|
- name: Idempotency test, show unchanged
|
|
community.general.etcd3:
|
|
key: "foo"
|
|
value: "baz"
|
|
state: "absent"
|
|
register: _etcd3_absnt_idmptntchktst
|
|
|
|
- name: Check that statuses are as expected
|
|
ansible.builtin.assert:
|
|
that:
|
|
- _etcd3_prst_chktst is changed
|
|
- _etcd3_prst_chgtst is changed
|
|
- _etcd3_prst_idmptnttst is not changed
|
|
- _etcd3_prst_idmptntchktst is not changed
|
|
- _etcd3_absnt_chktst is changed
|
|
- _etcd3_absnt_chgtst is changed
|
|
- _etcd3_absnt_idmptnttst is not changed
|
|
- _etcd3_absnt_idmptntchktst is not changed
|