Blame SOURCES/kdump-tier1-tags.diff

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