Add tests for ODL log configuration 70/74370/26
authorTaseer Ahmed <taseer94@gmail.com>
Tue, 24 Jul 2018 07:20:35 +0000 (12:20 +0500)
committerTaseer Ahmed <taseer94@gmail.com>
Wed, 22 Aug 2018 16:27:52 +0000 (21:27 +0500)
By default, the log-level for console should be info. The relevant
job overrides this to DEBUG, and these set of assertion verify the
desired behaviour, i.e the log-level is set to DEBUG.

Since, it is only possible to have one log mode, console or file,
this patch only tests the 'console' mode.

JIRA: INTPAK-40
Change-Id: I9b0ec79e41c25a4eeeef14f0d89572907b265281
Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
tests/test-odl-logs.yaml [new file with mode: 0644]

diff --git a/tests/test-odl-logs.yaml b/tests/test-odl-logs.yaml
new file mode 100644 (file)
index 0000000..ec570c5
--- /dev/null
@@ -0,0 +1,28 @@
+---
+
+- hosts: localhost
+  gather_facts: False
+  vars_files:
+    - vars.yaml
+  tasks:
+    - name: get log levels
+      command: /opt/opendaylight/bin/client log:get
+      register: log_levels
+
+    # These tests assume that the log level has already
+    # been set to DEBUG. This is done by over-riding the
+    # required variable while executing the installation
+    # through Jenkins Job
+    - name: assert ROOT log level set to DEBUG
+      assert:
+        that:
+          - "'ROOT                                │ DEBUG' in log_levels.stdout"
+
+    - name: save the logs
+      command: /opt/opendaylight/bin/client 'log:display -n 10'
+      register: odl_logs
+
+    - name: assert log level is DEBUG
+      assert:
+        that:
+          - "'DEBUG' in odl_logs.stdout"
\ No newline at end of file