mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Initial commit
This commit is contained in:
commit
aebc1b03fd
4861 changed files with 812621 additions and 0 deletions
21
tests/integration/targets/zypper_repository/tasks/main.yml
Normal file
21
tests/integration/targets/zypper_repository/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
# test code for the zypper repository module
|
||||
#
|
||||
# (c) 2016, Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- include: 'test.yml'
|
||||
when: ansible_os_family == 'Suse'
|
33
tests/integration/targets/zypper_repository/tasks/test.yml
Normal file
33
tests/integration/targets/zypper_repository/tasks/test.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
- name: collect repo configuration before test
|
||||
shell: "grep . /etc/zypp/repos.d/*"
|
||||
register: before
|
||||
|
||||
- name: ensure zypper ref works
|
||||
command: zypper -n ref
|
||||
|
||||
- block:
|
||||
- include: 'zypper_repository.yml'
|
||||
always:
|
||||
- name: remove repositories added during test
|
||||
zypper_repository:
|
||||
name: "{{item}}"
|
||||
state: absent
|
||||
with_items:
|
||||
- chrome1
|
||||
- chrome2
|
||||
- test
|
||||
- testrefresh
|
||||
- testprio
|
||||
- Apache_Modules
|
||||
|
||||
- name: collect repo configuration after test
|
||||
shell: "grep . /etc/zypp/repos.d/*"
|
||||
register: after
|
||||
|
||||
- name: verify repo configuration has been restored
|
||||
assert:
|
||||
that:
|
||||
- before.stdout == after.stdout
|
||||
|
||||
- name: ensure zypper ref still works
|
||||
command: zypper -n ref
|
|
@ -0,0 +1,127 @@
|
|||
- name: Delete test repo
|
||||
zypper_repository:
|
||||
name: test
|
||||
state: absent
|
||||
register: zypper_result
|
||||
|
||||
- name: Add test repo
|
||||
zypper_repository:
|
||||
name: test
|
||||
state: present
|
||||
repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
|
||||
register: zypper_result
|
||||
|
||||
- name: verify repo addition
|
||||
assert:
|
||||
that:
|
||||
- "zypper_result.changed"
|
||||
|
||||
- name: Add same repo again
|
||||
zypper_repository:
|
||||
name: test
|
||||
state: present
|
||||
repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
|
||||
register: zypper_result
|
||||
|
||||
- name: verify no change on second install
|
||||
assert:
|
||||
that:
|
||||
- "not zypper_result.changed"
|
||||
|
||||
- name: Change repo URL
|
||||
zypper_repository:
|
||||
name: test
|
||||
state: present
|
||||
repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/
|
||||
register: zypper_result
|
||||
|
||||
- name: Verify change on URL only change
|
||||
assert:
|
||||
that:
|
||||
- "zypper_result.changed"
|
||||
|
||||
- name: use refresh option
|
||||
zypper_repository:
|
||||
name: testrefresh
|
||||
refresh: no
|
||||
state: present
|
||||
repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/
|
||||
|
||||
- name: check refreshoption
|
||||
command: zypper -x lr testrefresh
|
||||
register: zypper_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"autorefresh=\"0\"" in zypper_result.stdout'
|
||||
|
||||
- name: set repo priority
|
||||
zypper_repository:
|
||||
name: testprio
|
||||
priority: 55
|
||||
state: present
|
||||
repo: http://download.videolan.org/pub/vlc/SuSE/Leap_{{ ansible_distribution_version }}/
|
||||
|
||||
- name: check refreshoption
|
||||
command: zypper -x lr testprio
|
||||
register: zypper_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"priority=\"55\"" in zypper_result.stdout'
|
||||
|
||||
- name: add two repos with same url
|
||||
zypper_repository:
|
||||
name: "{{item}}"
|
||||
state: present
|
||||
repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
|
||||
with_items:
|
||||
- chrome1
|
||||
- chrome2
|
||||
|
||||
- name: check repo is updated by url
|
||||
command: zypper lr chrome1
|
||||
register: zypper_result1
|
||||
ignore_errors: yes
|
||||
|
||||
- name: check repo is updated by url
|
||||
command: zypper lr chrome2
|
||||
register: zypper_result2
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "zypper_result1.rc != 0"
|
||||
- "'not found' in zypper_result1.stderr"
|
||||
- "zypper_result2.rc == 0"
|
||||
- "'http://dl.google.com/linux/chrome/rpm/stable/x86_64' in zypper_result2.stdout"
|
||||
|
||||
- name: add two repos with same name
|
||||
zypper_repository:
|
||||
name: samename
|
||||
state: present
|
||||
repo: "{{ item }}"
|
||||
with_items:
|
||||
- http://download.opensuse.org/repositories/science/openSUSE_Leap_{{ ansible_distribution_version }}/
|
||||
- http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/
|
||||
|
||||
- name: check repo is updated by name
|
||||
command: zypper lr samename
|
||||
register: zypper_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'/science/' not in zypper_result.stdout"
|
||||
- "'/devel:/languages:/ruby/' in zypper_result.stdout"
|
||||
|
||||
- name: remove last added repos (by URL to test that)
|
||||
zypper_repository:
|
||||
repo: http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_{{ ansible_distribution_version }}/
|
||||
state: absent
|
||||
|
||||
- name: "Test adding a repo with custom GPG key"
|
||||
zypper_repository:
|
||||
name: "Apache_Modules"
|
||||
repo: "http://download.opensuse.org/repositories/Apache:/Modules/openSUSE_Tumbleweed/"
|
||||
priority: 100
|
||||
auto_import_keys: true
|
||||
state: "present"
|
Loading…
Add table
Add a link
Reference in a new issue