[stable-10] Adjust YAML files (#10233) (#10244)

Adjust YAML files (#10233)

Adjust YAML files.

(cherry picked from commit eaa5e07b28)
This commit is contained in:
Felix Fontein 2025-06-15 10:02:03 +02:00 committed by GitHub
commit a9e892952d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
244 changed files with 7272 additions and 7329 deletions

View file

@ -9,60 +9,60 @@
- name: 'setup: create a dummy alternative'
block:
- import_tasks: setup.yml
- import_tasks: setup.yml
##############
# Test parameters:
# link parameter present / absent ('with_link' variable)
# with / without alternatives defined in alternatives file ('with_alternatives' variable)
# auto / manual ('mode' variable)
##############
# Test parameters:
# link parameter present / absent ('with_link' variable)
# with / without alternatives defined in alternatives file ('with_alternatives' variable)
# auto / manual ('mode' variable)
- include_tasks: tests.yml
with_nested:
- [ true, false ] # with_link
- [ true, false ] # with_alternatives
- [ 'auto', 'manual' ] # mode
loop_control:
loop_var: test_conf
- include_tasks: tests.yml
with_nested:
- [true, false] # with_link
- [true, false] # with_alternatives
- ['auto', 'manual'] # mode
loop_control:
loop_var: test_conf
##########
# Priority
- block:
- include_tasks: remove_links.yml
- include_tasks: setup_test.yml
# at least two iterations again
- include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4
vars:
with_alternatives: true
mode: auto
##########
# Priority
- block:
- include_tasks: remove_links.yml
- include_tasks: setup_test.yml
# at least two iterations again
- include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4
vars:
with_alternatives: true
mode: auto
- block:
- include_tasks: remove_links.yml
- include_tasks: setup_test.yml
# at least two iterations again
- include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4
vars:
with_alternatives: false
mode: auto
- block:
- include_tasks: remove_links.yml
- include_tasks: setup_test.yml
# at least two iterations again
- include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4
vars:
with_alternatives: false
mode: auto
# Test that path is checked: alternatives must fail when path is nonexistent
- import_tasks: path_is_checked.yml
# Test that path is checked: alternatives must fail when path is nonexistent
- import_tasks: path_is_checked.yml
# Test that subcommands commands work
- import_tasks: subcommands.yml
# Test that subcommands commands work
- import_tasks: subcommands.yml
# Test operation of the 'state' parameter
- block:
- include_tasks: remove_links.yml
- include_tasks: tests_state.yml
# Test operation of the 'state' parameter
- block:
- include_tasks: remove_links.yml
- include_tasks: tests_state.yml
# Test for the family parameter
- block:
- include_tasks: remove_links.yml
- include_tasks: tests_family.yml
when: ansible_os_family == 'RedHat'
# Test for the family parameter
- block:
- include_tasks: remove_links.yml
- include_tasks: tests_family.yml
when: ansible_os_family == 'RedHat'
# Cleanup
always:

View file

@ -5,11 +5,11 @@
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_os_family }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}.yml'
- default.yml
paths: ../vars
- files:
- '{{ ansible_os_family }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}.yml'
- default.yml
paths: ../vars
- template:
src: dummy_command
dest: /usr/bin/dummy{{ item }}

View file

@ -7,32 +7,32 @@
msg: ' with_alternatives: {{ with_alternatives }}, mode: {{ mode }}'
- block:
- name: set alternative (using link parameter)
alternatives:
name: dummy
path: '/usr/bin/dummy{{ item }}'
link: '/usr/bin/dummy'
register: alternative
- name: set alternative (using link parameter)
alternatives:
name: dummy
path: '/usr/bin/dummy{{ item }}'
link: '/usr/bin/dummy'
register: alternative
- name: check expected command was executed
assert:
that:
- 'alternative is successful'
- 'alternative is changed'
- name: check expected command was executed
assert:
that:
- 'alternative is successful'
- 'alternative is changed'
when: with_link
- block:
- name: set alternative (without link parameter)
alternatives:
name: dummy
path: '/usr/bin/dummy{{ item }}'
register: alternative
- name: set alternative (without link parameter)
alternatives:
name: dummy
path: '/usr/bin/dummy{{ item }}'
register: alternative
- name: check expected command was executed
assert:
that:
- 'alternative is successful'
- 'alternative is changed'
- name: check expected command was executed
assert:
that:
- 'alternative is successful'
- 'alternative is changed'
when: not with_link
- name: execute dummy command

View file

@ -4,13 +4,13 @@
# SPDX-License-Identifier: GPL-3.0-or-later
- block:
- include_tasks: remove_links.yml
- include_tasks: setup_test.yml
# at least two iterations:
# - first will use 'link currently absent',
# - second will receive 'link currently points to'
- include_tasks: test.yml
with_sequence: start=1 end=2
- include_tasks: remove_links.yml
- include_tasks: setup_test.yml
# at least two iterations:
# - first will use 'link currently absent',
# - second will receive 'link currently points to'
- include_tasks: test.yml
with_sequence: start=1 end=2
vars:
with_link: '{{ test_conf[0] }}'
with_alternatives: '{{ test_conf[1] }}'