From b5431b4065ac92898483b686153b4eca723546ab Mon Sep 17 00:00:00 2001 From: Tobias Zeuch Date: Fri, 29 Nov 2024 15:20:10 +0100 Subject: [PATCH] Adding tests for modifying the repository adding tests: * modifying a repository should work (disabling) * modifying a different parameter doesn't change configuation that was not specified - although it has a different default-value, than what is currenctly configured --- .../tasks/zypper_repository.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml b/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml index ec362af108..1d6f83dede 100644 --- a/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml +++ b/tests/integration/targets/zypper_repository/tasks/zypper_repository.yml @@ -246,6 +246,44 @@ that: - added_again_by_repo_file is not changed + - name: change the repository config by name with flag - disable + community.general.zypper_repository: + name: systemsmanagement_Uyuni_Stable + state: present + enabled: false + register: modified_repo_file_result + + - name: modified_repo_file_result is changed + assert: + that: + - modified_repo_file_result is changed + + - name: get repository details again from zypper after disabling the repository + command: zypper --xmlout lr systemsmanagement_Uyuni_Stable + register: get_repository_details_from_zypper + + - name: verify modifying via .repo file was successful - the module is now disabled + assert: + that: + - "'enabled=\"0\"' in get_repository_details_from_zypper.stdout" + + - name: change flag autorefresh in the same zypper-module + community.general.zypper_repository: + name: systemsmanagement_Uyuni_Stable + state: present + autorefresh: false + register: modified_repo_file_result + + - name: get repository details again from zypper after disabling the repository + command: zypper --xmlout lr systemsmanagement_Uyuni_Stable + register: get_repository_details_from_zypper + + - name: verify modifying via .repo file was successful - the autorefesh is disabled, but the enabled-flag was not modified (it is still disabled) + assert: + that: + - "'enabled=\"0\"' in get_repository_details_from_zypper.stdout" + - "'autorefresh=\"0\"' in get_repository_details_from_zypper.stdout" + - name: remove repository via url to .repo file community.general.zypper_repository: repo: http://download.opensuse.org/repositories/systemsmanagement:/Uyuni:/Stable/openSUSE_Leap_{{ ansible_distribution_version }}/systemsmanagement:Uyuni:Stable.repo