]> granicus.if.org Git - icinga2/commitdiff
Add file existence tests
authorJohannes Meyer <johannes.meyer@netways.de>
Thu, 5 Dec 2013 08:46:51 +0000 (09:46 +0100)
committerJohannes Meyer <johannes.meyer@netways.de>
Mon, 16 Dec 2013 14:37:37 +0000 (15:37 +0100)
refs #5223

test/jenkins/external_commandpipe.test [new file with mode: 0755]
test/jenkins/livestatus_socket.test [new file with mode: 0755]
test/jenkins/logfile.test [new file with mode: 0755]
test/jenkins/pidfile.test [new file with mode: 0755]
test/jenkins/statusdata.test [new file with mode: 0755]

diff --git a/test/jenkins/external_commandpipe.test b/test/jenkins/external_commandpipe.test
new file mode 100755 (executable)
index 0000000..5b855e1
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ -e "/var/run/icinga2/cmd/icinga2.cmd" ];
+then
+    echo "Icinga2 commandpipe found"
+    exit 0
+else
+    echo "Icinga2 commandpipe not found"
+    exit 1
+fi
diff --git a/test/jenkins/livestatus_socket.test b/test/jenkins/livestatus_socket.test
new file mode 100755 (executable)
index 0000000..f7b0b4c
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ ! -e /var/run/icinga2/cmd/livestatus ];
+then
+    sudo icinga2-enable-feature livestatus 1> /dev/null
+    sudo service icinga2 restart 1> /dev/null
+    sleep 1
+
+    if [ ! -e /var/run/icinga2/cmd/livestatus ];
+    then
+        echo "Icinga2 Livestatus socket not found"
+        exit 1
+    fi
+fi
+
+echo "Icinga2 Livestatus socket found"
+exit 0
diff --git a/test/jenkins/logfile.test b/test/jenkins/logfile.test
new file mode 100755 (executable)
index 0000000..ae77a56
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if sudo test -f /var/log/icinga2/icinga2.log;
+then
+    echo "Icinga2 log file found"
+    exit 0
+else
+    echo "Icinga2 log file not found"
+    exit 1
+fi
diff --git a/test/jenkins/pidfile.test b/test/jenkins/pidfile.test
new file mode 100755 (executable)
index 0000000..28c4fde
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ -f /var/run/icinga2/icinga2.pid ];
+then
+    echo "Icinga2 pidfile found"
+    exit 0
+else
+    echo "Icinga2 pidfile not found"
+    exit 1
+fi
diff --git a/test/jenkins/statusdata.test b/test/jenkins/statusdata.test
new file mode 100755 (executable)
index 0000000..6599795
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+if [ ! -f /var/cache/icinga2/status.dat ];
+then
+    sudo icinga2-enable-feature statusdata 1> /dev/null
+    sudo service icinga2 restart 1> /dev/null
+
+    n=0
+    while [ $n -lt 3 ]
+    do
+        sleep 15
+
+        if [ -f /var/cache/icinga2/status.dat ];
+        then
+            break
+        fi
+
+        n=$(( $n + 1))
+    done
+
+    if [ $n -eq 3 ];
+    then
+        echo "Icinga2 status.dat not found"
+        exit 1
+    fi
+fi
+
+echo "Icinga2 status.dat found"
+
+if [ -f /var/cache/icinga2/objects.cache ];
+then
+    echo "Icinga2 objects.cache found"
+    exit 0
+else
+    echo "Icinga2 objects.cache not found"
+    exit 1
+fi