summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@ansible.com>2016-03-21 11:00:50 -0700
committerBrian Coca <bcoca@ansible.com>2016-03-21 11:00:50 -0700
commit9c6b49fd3d1858906f23d10edeafff7cef4c0d9d (patch)
tree86d0aa504f2856bcb9241894d604a78c9f094a39
parent3ae9a272e0d1c7453d20ed2c3ecdcac7841b86dd (diff)
parent2095d1ab33551627e8fb098801705b633c4e0ee2 (diff)
downloadansible-9c6b49fd3d1858906f23d10edeafff7cef4c0d9d.tar.gz
Merge pull request #15004 from agx/zypper-repository-integration-tests
Integration tests for zypper repository
-rw-r--r--test/integration/destructive.yml1
-rw-r--r--test/integration/roles/test_zypper_repository/meta/main.yml2
-rw-r--r--test/integration/roles/test_zypper_repository/tasks/main.yml22
-rw-r--r--test/integration/roles/test_zypper_repository/tasks/zypper_repository.yml43
4 files changed, 68 insertions, 0 deletions
diff --git a/test/integration/destructive.yml b/test/integration/destructive.yml
index 3e8cca385e..5dd590f856 100644
--- a/test/integration/destructive.yml
+++ b/test/integration/destructive.yml
@@ -19,3 +19,4 @@
- { role: test_mysql_variables, tags: test_mysql_variables}
- { role: test_docker, tags: test_docker, when: ansible_distribution != "Fedora" }
- { role: test_zypper, tags: test_zypper}
+ - { role: test_zypper_repository, tags: test_zypper_repository}
diff --git a/test/integration/roles/test_zypper_repository/meta/main.yml b/test/integration/roles/test_zypper_repository/meta/main.yml
new file mode 100644
index 0000000000..07faa21776
--- /dev/null
+++ b/test/integration/roles/test_zypper_repository/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_tests
diff --git a/test/integration/roles/test_zypper_repository/tasks/main.yml b/test/integration/roles/test_zypper_repository/tasks/main.yml
new file mode 100644
index 0000000000..a805d6e25c
--- /dev/null
+++ b/test/integration/roles/test_zypper_repository/tasks/main.yml
@@ -0,0 +1,22 @@
+# 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: 'zypper_repository.yml'
+ when: ansible_distribution in ['SLES', 'openSUSE']
+
diff --git a/test/integration/roles/test_zypper_repository/tasks/zypper_repository.yml b/test/integration/roles/test_zypper_repository/tasks/zypper_repository.yml
new file mode 100644
index 0000000000..d363e368a7
--- /dev/null
+++ b/test/integration/roles/test_zypper_repository/tasks/zypper_repository.yml
@@ -0,0 +1,43 @@
+- name: Delete
+ zypper_repository:
+ name: test
+ state: absent
+ register: zypper_result
+
+- name: Add repo
+ zypper_repository:
+ name: test
+ state: present
+ repo: http://dl.google.com/linux/chrome/rpm/stable/x86_64
+ register: zypper_result
+
+- debug: var=zypper_result
+
+- name: verify repo addition
+ assert:
+ that:
+ - "zypper_result.changed"
+
+- name: Add 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_42.1/
+ register: zypper_result
+
+- name: Verify change on URL only change
+ assert:
+ that:
+ - "zypper_result.changed"