Blame SOURCES/kdump-tier1-tags.diff

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