Blame SOURCES/kdump-tier1-tags.diff

48847c
diff --git a/tests/commonvars.yml b/tests/commonvars.yml
48847c
new file mode 100644
48847c
index 0000000..2cd3566
48847c
--- /dev/null
48847c
+++ b/tests/commonvars.yml
48847c
@@ -0,0 +1,2 @@
48847c
+restore_services:
48847c
+  - kdump
48847c
diff --git a/tests/get_services_state.yml b/tests/get_services_state.yml
48847c
new file mode 100644
48847c
index 0000000..4fe5d36
48847c
--- /dev/null
48847c
+++ b/tests/get_services_state.yml
48847c
@@ -0,0 +1,4 @@
48847c
+- name: Get initial state of services
48847c
+  tags: tests::cleanup
48847c
+  service_facts:
48847c
+  register: initial_state
48847c
diff --git a/tests/restore_services_state.yml b/tests/restore_services_state.yml
48847c
new file mode 100644
48847c
index 0000000..2035dfc
48847c
--- /dev/null
48847c
+++ b/tests/restore_services_state.yml
48847c
@@ -0,0 +1,22 @@
48847c
+- block:
48847c
+    - name: load common vars
48847c
+      include_vars:
48847c
+        file: commonvars.yml
48847c
+
48847c
+    - name: Get final state of services
48847c
+      service_facts:
48847c
+      register: final_state
48847c
+
48847c
+    - name: Restore state of services
48847c
+      service:
48847c
+        name: "{{ item }}"
48847c
+        state: "{{ 'started' if
48847c
+                   initial_state.ansible_facts.services[sname]['state']
48847c
+                   == 'running' else 'stopped' }}"
48847c
+      when:
48847c
+         - sname in final_state.ansible_facts.services
48847c
+         - sname in initial_state.ansible_facts.services
48847c
+      vars:
48847c
+        sname: "{{ item + '.service' }}"
48847c
+      with_items: "{{ restore_services }}"
48847c
+  tags: tests::cleanup
48847c
diff --git a/tests/tests_default.yml b/tests/tests_default.yml
6e715b
index af0b2a0..6ce5241 100644
48847c
--- a/tests/tests_default.yml
48847c
+++ b/tests/tests_default.yml
6e715b
@@ -3,3 +3,13 @@
48847c
 
48847c
   roles:
6e715b
     - linux-system-roles.kdump
48847c
+
48847c
+  pre_tasks:
48847c
+    - name: Import tasks
6e715b
+#      tags: tests::tier1::cleanup
48847c
+      import_tasks: get_services_state.yml
48847c
+
48847c
+  post_tasks:
48847c
+    - name: Import tasks
6e715b
+#      tags: tests::tier1::cleanup
48847c
+      import_tasks: restore_services_state.yml
48847c
diff --git a/tests/tests_default_wrapper.yml b/tests/tests_default_wrapper.yml
6e715b
index eba31a0..857aab8 100644
48847c
--- a/tests/tests_default_wrapper.yml
48847c
+++ b/tests/tests_default_wrapper.yml
48847c
@@ -1,6 +1,9 @@
48847c
 ---
48847c
 - name: Create static inventory from hostvars
48847c
   hosts: all
48847c
+  tags:
6e715b
+#    - 'tests::tier1'
48847c
+    - 'tests::slow'
48847c
   tasks:
48847c
     - name: create temporary file
48847c
       tempfile:
48847c
@@ -17,10 +20,16 @@
48847c
 
48847c
 
48847c
 - name: Run tests_default.yml normally
48847c
+  tags:
6e715b
+#    - 'tests::tier1'
48847c
+    - 'tests::slow'
48847c
   import_playbook: tests_default.yml
48847c
 
48847c
 - name: Run tests_default.yml in check_mode
48847c
   hosts: all
48847c
+  tags:
6e715b
+#    - 'tests::tier1'
48847c
+    - 'tests::slow'
48847c
   tasks:
48847c
     - name: Run ansible-playbook with tests_default.yml in check mode
6e715b
       command: >
6e715b
diff --git a/tests/tests_ssh.yml b/tests/tests_ssh.yml
6e715b
index d12e884..6d3699c 100644
6e715b
--- a/tests/tests_ssh.yml
6e715b
+++ b/tests/tests_ssh.yml
6e715b
@@ -10,6 +10,13 @@
6e715b
     # this is the address at which the ssh dump server can be reached
6e715b
     # from the managed host. Dumps will be uploaded there.
6e715b
     kdump_ssh_server_inside: "{{ kdump_ssh_source if kdump_ssh_source in hostvars[kdump_ssh_server_outside]['ansible_all_ipv4_addresses'] + hostvars[kdump_ssh_server_outside]['ansible_all_ipv6_addresses']  else hostvars[kdump_ssh_server_outside]['ansible_default_ipv4']['address'] }}"
6e715b
+  tags:
6e715b
+    # this test executes some tasks on localhost and relies on
6e715b
+    # localhost being a different host than the managed host
6e715b
+    # (localhost is being used as a second host in multihost
6e715b
+    # scenario). This also means that localhost must be capable
6e715b
+    # enough (not just a container - must be runnign a sshd).
6e715b
+    - 'tests::multihost_localhost'
6e715b
 
6e715b
   tasks:
6e715b
     - name: gather facts from {{ kdump_ssh_server_outside }}
6e715b
diff --git a/tests/tests_ssh_wrapper.yml b/tests/tests_ssh_wrapper.yml
6e715b
index 2203f3f..96a764e 100644
6e715b
--- a/tests/tests_ssh_wrapper.yml
6e715b
+++ b/tests/tests_ssh_wrapper.yml
6e715b
@@ -1,6 +1,8 @@
6e715b
 ---
6e715b
 - name: Create static inventory from hostvars
6e715b
   hosts: all
6e715b
+  tags:
6e715b
+    - 'tests::slow'
6e715b
   tasks:
6e715b
     - name: create temporary file
6e715b
       tempfile:
6e715b
@@ -17,10 +19,15 @@
6e715b
 
6e715b
 
6e715b
 - name: Run tests_ssh.yml normally
6e715b
+  tags:
6e715b
+    - 'tests::slow'
6e715b
   import_playbook: tests_ssh.yml
6e715b
 
6e715b
 - name: Run tests_ssh.yml in check_mode
6e715b
   hosts: all
6e715b
+  tags:
6e715b
+    - 'tests::slow'
6e715b
+    - 'tests::multihost_localhost'
6e715b
   tasks:
6e715b
     - name: Run ansible-playbook with tests_ssh.yml in check mode
6e715b
       command: |