mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
Logstash plugin version fix (#11440)
* logstash_plugin: fix argument order when using version parameter * logstash_plugin: add integration tests * logstash_plugin: add changelog fragment
This commit is contained in:
parent
c0df366471
commit
53e1e86bcc
4 changed files with 82 additions and 1 deletions
5
tests/integration/targets/logstash_plugin/aliases
Normal file
5
tests/integration/targets/logstash_plugin/aliases
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
unsupported
|
||||
72
tests/integration/targets/logstash_plugin/tasks/main.yml
Normal file
72
tests/integration/targets/logstash_plugin/tasks/main.yml
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
# Copyright (c) Ansible Project
|
||||
# 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
|
||||
|
||||
- name: Check if logstash-plugin is available
|
||||
ansible.builtin.stat:
|
||||
path: /usr/share/logstash/bin/logstash-plugin
|
||||
register: logstash_plugin_bin
|
||||
|
||||
- name: Run logstash_plugin tests
|
||||
when: logstash_plugin_bin.stat.exists
|
||||
block:
|
||||
- name: Install plugin without version (should succeed)
|
||||
community.general.logstash_plugin:
|
||||
name: logstash-filter-dissect
|
||||
state: present
|
||||
register: install_no_version
|
||||
|
||||
- name: Assert plugin installed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_no_version is changed
|
||||
|
||||
- name: Install same plugin again (idempotency)
|
||||
community.general.logstash_plugin:
|
||||
name: logstash-filter-dissect
|
||||
state: present
|
||||
register: install_no_version_again
|
||||
|
||||
- name: Assert idempotency without version
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_no_version_again is not changed
|
||||
|
||||
- name: Remove plugin for version test
|
||||
community.general.logstash_plugin:
|
||||
name: logstash-filter-dissect
|
||||
state: absent
|
||||
|
||||
- name: Install plugin with specific version
|
||||
community.general.logstash_plugin:
|
||||
name: logstash-filter-dissect
|
||||
state: present
|
||||
version: "3.2.0"
|
||||
register: install_with_version
|
||||
|
||||
- name: Assert plugin with version installed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_with_version is changed
|
||||
|
||||
- name: Verify command has correct argument order
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
# The cmd output should show --version before plugin name
|
||||
- "'--version' in install_with_version.cmd"
|
||||
- "'3.2.0' in install_with_version.cmd"
|
||||
- "install_with_version.cmd.index('--version') < install_with_version.cmd.index('logstash-filter-dissect')"
|
||||
|
||||
always:
|
||||
- name: Cleanup - remove test plugin
|
||||
community.general.logstash_plugin:
|
||||
name: logstash-filter-dissect
|
||||
state: absent
|
||||
when: logstash_plugin_bin.stat.exists
|
||||
ignore_errors: true
|
||||
Loading…
Add table
Add a link
Reference in a new issue