From a880dd9ed1a8846ff24db9f18d25b3be9cc3012e Mon Sep 17 00:00:00 2001
From: Luis Araujo <luis.araujo@collabora.co.uk>
Date: Fri, 14 Dec 2018 00:39:36 +0800
Subject: [PATCH] Update test cases for lava integration (apparmor)

This commit applies the required changes to the test cases so
they can be executed in LAVA.

The change consists in adding the `git-repos` directive so they
can fetch the tests scripts from LAVA.

This is the apparmor group in a serie of commits to integrate
all the tests into LAVA.

Signed-off-by: Luis Araujo <luis.araujo@collabora.co.uk>
---
 test-cases/apparmor-basic-profiles.yaml  |  9 +++++++--
 test-cases/apparmor-chaiwala-system.yaml |  9 +++++++--
 test-cases/apparmor-dbus.yaml            | 12 +++++++++---
 test-cases/apparmor-pulseaudio.yaml      | 10 +++++++---
 test-cases/apparmor-tumbler.yaml         |  8 ++++++--
 5 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/test-cases/apparmor-basic-profiles.yaml b/test-cases/apparmor-basic-profiles.yaml
index d12ba9e..a355920 100644
--- a/test-cases/apparmor-basic-profiles.yaml
+++ b/test-cases/apparmor-basic-profiles.yaml
@@ -12,8 +12,6 @@ metadata:
                 basic Apparmor profiles is part of strategic application and
                 services confinement."
 
-  macro_ostree_preconditions: apparmor-basic-profiles
-
   expected:
     - "The automated test should succeed:"
     - |
@@ -26,8 +24,15 @@ metadata:
         >>>> The following tests FAILED:
         [list of tests]
 
+install:
+  git-repos:
+    - url: https://gitlab.apertis.org/tests/apparmor-basic-profiles.git
+      branch: master
+
 run:
   steps:
+    - "# Enter test directory:"
+    - cd apparmor-basic-profiles
     - "# Execute the following command:"
     - common/run-test-in-systemd --user=user --timeout=90 ./run-test.sh
 
diff --git a/test-cases/apparmor-chaiwala-system.yaml b/test-cases/apparmor-chaiwala-system.yaml
index df95f8a..fb96a12 100644
--- a/test-cases/apparmor-chaiwala-system.yaml
+++ b/test-cases/apparmor-chaiwala-system.yaml
@@ -10,8 +10,6 @@ metadata:
   description: "Test that AppArmor's system wide rules works according to Apertis
                 security goals (Chaiwala was an older codename for Apertis)."
 
-  macro_ostree_preconditions: apparmor-chaiwala-system
-
   expected:
     - "The run-test.sh script should return 0. The return value indicates the
        number of tests which failed. A similar output will be shown:"
@@ -25,8 +23,15 @@ metadata:
     - "This tests only check that system wide rules (not components ones) are
        correctly implemented."
 
+install:
+  git-repos:
+    - url: https://gitlab.apertis.org/tests/apparmor-chaiwala-system.git
+      branch: master
+
 run:
   steps:
+    - "# Enter test directory:"
+    - cd apparmor-chaiwala-system
     - "# Execute the following command:"
     - common/run-test-in-systemd --timeout=90 --basename ./run-test.sh
 
diff --git a/test-cases/apparmor-dbus.yaml b/test-cases/apparmor-dbus.yaml
index f8ca03d..b5457ac 100644
--- a/test-cases/apparmor-dbus.yaml
+++ b/test-cases/apparmor-dbus.yaml
@@ -10,8 +10,6 @@ metadata:
   description: "Security infrastructure: AppArmor D-Bus mediation is part of
                 strategic application and service confinement."
 
-  macro_ostree_preconditions: apparmor-dbus
-
   expected:
     - "The test should report pass and not fail:"
     - |
@@ -23,9 +21,17 @@ metadata:
     - "If you get a failure and need to report a bug please add the apparmor logs
        from sudo journalctl."
 
+install:
+  git-repos:
+    - url: https://gitlab.apertis.org/tests/apparmor-dbus.git
+      branch: master
+
 run:
   steps:
-  - LAUNCH_DBUS="no" common/run-aa-test ./dbus.expected ./dbus
+    - "# Enter test directory:"
+    - cd apparmor-dbus
+    - "# Execute the following command:"
+    - LAUNCH_DBUS="no" common/run-aa-test ./dbus.expected ./dbus
 
 parse:
   pattern: 'RESULT:(?P<result>\w+):(?P<test_case_id>[^:]+):'
diff --git a/test-cases/apparmor-pulseaudio.yaml b/test-cases/apparmor-pulseaudio.yaml
index efab7e1..1733d43 100644
--- a/test-cases/apparmor-pulseaudio.yaml
+++ b/test-cases/apparmor-pulseaudio.yaml
@@ -10,8 +10,6 @@ metadata:
   description: "Test that AppArmor profiles provided in PulseAudio work without
                 apparmor complaining."
 
-  macro_ostree_preconditions: apparmor-pulseaudio
-
   expected:
     - "Both tests should report pass and not fail:"
     - |
@@ -24,11 +22,17 @@ metadata:
     - "If you get a failure and need to report a bug please check journalctl, run
        the test case again, and add the logs you get to the bug report."
 
+install:
+  git-repos:
+    - url: https://gitlab.apertis.org/tests/apparmor-pulseaudio.git
+      branch: master
+
 run:
   steps:
+    - "# Enter test directory:"
+    - cd apparmor-pulseaudio
     - "# Execute the following command:"
     - common/run-test-in-systemd --name run-test-sh --timeout 90 ./run-test.sh
 
-
 parse:
   pattern: ^(?P<test_case_id>[\w\-\.]+):\s(?P<result>PASS|pass|FAIL|fail|SKIP|skip|UNKNOWN|unknown)$
diff --git a/test-cases/apparmor-tumbler.yaml b/test-cases/apparmor-tumbler.yaml
index 6359eff..d23cc86 100644
--- a/test-cases/apparmor-tumbler.yaml
+++ b/test-cases/apparmor-tumbler.yaml
@@ -12,8 +12,6 @@ metadata:
                 that it does not allow arbitrary reading of files in the home
                 directory."
 
-  macro_ostree_preconditions: apparmor-tumbler
-
   expected:
     - "Both tests should report pass and not fail:"
     - |
@@ -25,9 +23,15 @@ metadata:
        determine whether they passed or fail."
     - "If you get a failure and need to report a bug please check journalctl, run
        the test case again, and add the logs you get to the bug report."
+install:
+  git-repos:
+    - url: https://gitlab.apertis.org/tests/apparmor-tumbler.git
+      branch: master
 
 run:
   steps:
+    - "# Enter test directory:"
+    - cd apparmor-tumbler
     - "# Execute the following commands:"
     - common/run-test-in-systemd --name run-test-sh --timeout 900 ./run-test.sh
 
-- 
GitLab