From 7ccd7d03c91990f7915249a29d08ff966e3442d6 Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Apr 12 2017 07:41:42 +0000
Subject: [PATCH 1/5] POC how modularity testing framework can work in ansible (It will use testmodule and use koji build testmodule-master-20170410111210) and run tests from examples


---

diff --git a/tests/mtf-testmodule/playbooks/configure.yml b/tests/mtf-testmodule/playbooks/configure.yml
new file mode 100644
index 0000000..3de2abb
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/configure.yml
@@ -0,0 +1,6 @@
+- hosts: local
+  become: '{{ sudo | default("no") }}'
+  remote_user: '{{ user | default("root") }}'
+  roles:
+    - configure
+
diff --git a/tests/mtf-testmodule/playbooks/group_vars/all/global.yml b/tests/mtf-testmodule/playbooks/group_vars/all/global.yml
new file mode 100644
index 0000000..e03d06a
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/group_vars/all/global.yml
@@ -0,0 +1,2 @@
+---
+# Some global set for all roles
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/defaults/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/defaults/main.yml
new file mode 100644
index 0000000..a211d4a
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/configure/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for configure
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/handlers/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/handlers/main.yml
new file mode 100644
index 0000000..71232bb
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/configure/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for configure
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/meta/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/meta/main.yml
new file mode 100644
index 0000000..4f4ec2a
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/configure/meta/main.yml
@@ -0,0 +1,4 @@
+#dependencies: []
+  # List your role dependencies here, one per line.
+  # Be sure to remove the '[]' above if you add dependencies
+  # to this list.
\ No newline at end of file
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/tasks/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/tasks/main.yml
new file mode 100644
index 0000000..d657099
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/configure/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+# tasks file for configure
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/defaults/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/defaults/main.yml
new file mode 100644
index 0000000..2e646d9
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/run_tests/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for run_tests
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/files/test-simple b/tests/mtf-testmodule/playbooks/roles/run_tests/files/test-simple
new file mode 100644
index 0000000..4020fe5
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/run_tests/files/test-simple
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -ex
+
+# exercise installed gzip/gunzip programs
+echo "Bla" > bla.file
+cp bla.file bla.file.orig
+gzip bla.file
+gunzip bla.file.gz
+cmp bla.file bla.file.orig
+rm bla.file bla.file.orig
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/handlers/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/handlers/main.yml
new file mode 100644
index 0000000..4361f76
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/run_tests/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for run_tests
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/meta/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/meta/main.yml
new file mode 100644
index 0000000..5728b36
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/run_tests/meta/main.yml
@@ -0,0 +1,6 @@
+---
+dependencies: []
+  # List your role dependencies here, one per line.
+  # Be sure to remove the '[]' above if you add dependencies
+  # to this list.
+  - { role: configure }
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/tasks/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/tasks/main.yml
new file mode 100644
index 0000000..840ae6a
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/roles/run_tests/tasks/main.yml
@@ -0,0 +1,30 @@
+---
+# tasks file for run_tests
+- name: Install the requirements
+  package: 
+    name: "{{item}}" 
+    state: latest
+  with_items:
+    - coreutils
+    - /sbin/install-info
+    - gzip
+
+- name: Create the folder where we will store the tests
+  file: 
+    path: "{{ item }}"
+    state: directory
+    owner: root
+    group: root
+  with_items:
+    - /usr/libexec/tests/gzip/
+
+- name: Install the test files
+  copy: 
+    src: "{{ item.file }}" 
+    dest: "/usr/libexec/tests/gzip/{{ item.dest }}"
+    mode: 0755
+  with_items:
+    - {file: test-simple, dest: test-simple }
+
+- name: Execute the tests
+  shell: /usr/libexec/tests/gzip/test-simple
diff --git a/tests/mtf-testmodule/playbooks/run_tests.yml b/tests/mtf-testmodule/playbooks/run_tests.yml
new file mode 100644
index 0000000..9a2c498
--- /dev/null
+++ b/tests/mtf-testmodule/playbooks/run_tests.yml
@@ -0,0 +1,7 @@
+- hosts: local
+  become: '{{ sudo | default("no") }}'
+  remote_user: '{{ user | default("root") }}'
+  roles:
+    - { role: configure }
+    - run_tests
+
diff --git a/tests/mtf-testmodule/run_tests.yml b/tests/mtf-testmodule/run_tests.yml
new file mode 100644
index 0000000..1d3363c
--- /dev/null
+++ b/tests/mtf-testmodule/run_tests.yml
@@ -0,0 +1,18 @@
+---
+- hosts: localhost
+  remote_user: root
+  tasks:
+  - name: Setup repositories
+    shell: dnf copr -y enable jscotka/modularity-testing-framework
+  - name: Install the requirements
+    package: name={{item}} state=latest
+    with_items:
+    - modularity-testing-framework
+ 
+  - name: Create the folder where we will store the tests
+    action: file state=directory path={{ item }}
+            owner=root group=root
+    with_items:
+    - /usr/libexec/tests/mtf/
+  - name: Execute the tests for testmodule
+    shell: /usr/share/moduleframework/tools/run-them.sh testmodule testmodule-master-20170410111210 taskotron

From 85ed08128a4f51a523ad86b1e342fc422cc10356 Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Apr 12 2017 07:50:51 +0000
Subject: [PATCH 2/5] removed nonnecessary files


---

diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/defaults/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/defaults/main.yml
deleted file mode 100644
index 2e646d9..0000000
--- a/tests/mtf-testmodule/playbooks/roles/run_tests/defaults/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# defaults file for run_tests
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/files/test-simple b/tests/mtf-testmodule/playbooks/roles/run_tests/files/test-simple
deleted file mode 100644
index 4020fe5..0000000
--- a/tests/mtf-testmodule/playbooks/roles/run_tests/files/test-simple
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-set -ex
-
-# exercise installed gzip/gunzip programs
-echo "Bla" > bla.file
-cp bla.file bla.file.orig
-gzip bla.file
-gunzip bla.file.gz
-cmp bla.file bla.file.orig
-rm bla.file bla.file.orig
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/handlers/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/handlers/main.yml
deleted file mode 100644
index 4361f76..0000000
--- a/tests/mtf-testmodule/playbooks/roles/run_tests/handlers/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# handlers file for run_tests
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/meta/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/meta/main.yml
deleted file mode 100644
index 5728b36..0000000
--- a/tests/mtf-testmodule/playbooks/roles/run_tests/meta/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-dependencies: []
-  # List your role dependencies here, one per line.
-  # Be sure to remove the '[]' above if you add dependencies
-  # to this list.
-  - { role: configure }
diff --git a/tests/mtf-testmodule/playbooks/roles/run_tests/tasks/main.yml b/tests/mtf-testmodule/playbooks/roles/run_tests/tasks/main.yml
deleted file mode 100644
index 840ae6a..0000000
--- a/tests/mtf-testmodule/playbooks/roles/run_tests/tasks/main.yml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-# tasks file for run_tests
-- name: Install the requirements
-  package: 
-    name: "{{item}}" 
-    state: latest
-  with_items:
-    - coreutils
-    - /sbin/install-info
-    - gzip
-
-- name: Create the folder where we will store the tests
-  file: 
-    path: "{{ item }}"
-    state: directory
-    owner: root
-    group: root
-  with_items:
-    - /usr/libexec/tests/gzip/
-
-- name: Install the test files
-  copy: 
-    src: "{{ item.file }}" 
-    dest: "/usr/libexec/tests/gzip/{{ item.dest }}"
-    mode: 0755
-  with_items:
-    - {file: test-simple, dest: test-simple }
-
-- name: Execute the tests
-  shell: /usr/libexec/tests/gzip/test-simple

From 4d70da4d26a5e105a256dda4ded40ffcd03cacee Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Apr 12 2017 07:52:11 +0000
Subject: [PATCH 3/5] removed nonnecessary files


---

diff --git a/tests/mtf-testmodule/playbooks/configure.yml b/tests/mtf-testmodule/playbooks/configure.yml
deleted file mode 100644
index 3de2abb..0000000
--- a/tests/mtf-testmodule/playbooks/configure.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- hosts: local
-  become: '{{ sudo | default("no") }}'
-  remote_user: '{{ user | default("root") }}'
-  roles:
-    - configure
-
diff --git a/tests/mtf-testmodule/playbooks/group_vars/all/global.yml b/tests/mtf-testmodule/playbooks/group_vars/all/global.yml
deleted file mode 100644
index e03d06a..0000000
--- a/tests/mtf-testmodule/playbooks/group_vars/all/global.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# Some global set for all roles
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/defaults/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/defaults/main.yml
deleted file mode 100644
index a211d4a..0000000
--- a/tests/mtf-testmodule/playbooks/roles/configure/defaults/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# defaults file for configure
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/handlers/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/handlers/main.yml
deleted file mode 100644
index 71232bb..0000000
--- a/tests/mtf-testmodule/playbooks/roles/configure/handlers/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# handlers file for configure
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/meta/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/meta/main.yml
deleted file mode 100644
index 4f4ec2a..0000000
--- a/tests/mtf-testmodule/playbooks/roles/configure/meta/main.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-#dependencies: []
-  # List your role dependencies here, one per line.
-  # Be sure to remove the '[]' above if you add dependencies
-  # to this list.
\ No newline at end of file
diff --git a/tests/mtf-testmodule/playbooks/roles/configure/tasks/main.yml b/tests/mtf-testmodule/playbooks/roles/configure/tasks/main.yml
deleted file mode 100644
index d657099..0000000
--- a/tests/mtf-testmodule/playbooks/roles/configure/tasks/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# tasks file for configure
diff --git a/tests/mtf-testmodule/playbooks/run_tests.yml b/tests/mtf-testmodule/playbooks/run_tests.yml
deleted file mode 100644
index 9a2c498..0000000
--- a/tests/mtf-testmodule/playbooks/run_tests.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-- hosts: local
-  become: '{{ sudo | default("no") }}'
-  remote_user: '{{ user | default("root") }}'
-  roles:
-    - { role: configure }
-    - run_tests
-

From febc4867ffe550173db10fff8ec6eeb196088e61 Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Apr 12 2017 07:56:01 +0000
Subject: [PATCH 4/5] better description


---

diff --git a/tests/mtf-testmodule/run_tests.yml b/tests/mtf-testmodule/run_tests.yml
index 1d3363c..bcbafbd 100644
--- a/tests/mtf-testmodule/run_tests.yml
+++ b/tests/mtf-testmodule/run_tests.yml
@@ -14,5 +14,5 @@
             owner=root group=root
     with_items:
     - /usr/libexec/tests/mtf/
-  - name: Execute the tests for testmodule
+  - name: Execute the testsuite for testmodule downloaded by run-them.sh script
     shell: /usr/share/moduleframework/tools/run-them.sh testmodule testmodule-master-20170410111210 taskotron

From 44102472804ce9d2bda098d22d62a5ea5a84cbc8 Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Apr 12 2017 07:57:17 +0000
Subject: [PATCH 5/5] removed creating directory for tests because test are downloaded


---

diff --git a/tests/mtf-testmodule/run_tests.yml b/tests/mtf-testmodule/run_tests.yml
index bcbafbd..950f34a 100644
--- a/tests/mtf-testmodule/run_tests.yml
+++ b/tests/mtf-testmodule/run_tests.yml
@@ -8,11 +8,5 @@
     package: name={{item}} state=latest
     with_items:
     - modularity-testing-framework
- 
-  - name: Create the folder where we will store the tests
-    action: file state=directory path={{ item }}
-            owner=root group=root
-    with_items:
-    - /usr/libexec/tests/mtf/
   - name: Execute the testsuite for testmodule downloaded by run-them.sh script
     shell: /usr/share/moduleframework/tools/run-them.sh testmodule testmodule-master-20170410111210 taskotron

