From feffd957f98f3f5f91602a7ad8025ac7232453b5 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 28 Feb 2025 17:07:37 +0100
Subject: [PATCH] update tests

---
 TODO.md                       |  4 ++--
 tests/200_diskfree.php        |  4 ++--
 tests/200_hello.php           |  7 +++++++
 tests/200_httpcontent.php     |  7 +++++++
 tests/200_loadmeter.php       |  7 +++++++
 tests/200_simple.php          |  7 -------
 tests/configs/httpcontent.ini | 23 +++++++++++++++++++++++
 tests/configs/loadmeter.ini   | 23 +++++++++++++++++++++++
 8 files changed, 71 insertions(+), 11 deletions(-)
 create mode 100644 tests/200_hello.php
 create mode 100644 tests/200_httpcontent.php
 create mode 100644 tests/200_loadmeter.php
 delete mode 100644 tests/200_simple.php
 create mode 100644 tests/configs/httpcontent.ini
 create mode 100644 tests/configs/loadmeter.ini

diff --git a/TODO.md b/TODO.md
index ccd91b2..eaa02fb 100644
--- a/TODO.md
+++ b/TODO.md
@@ -18,8 +18,8 @@ was ich so sehe ...
     ✅ Exec
     ⬜ File --> "exists": false meldet bei Test einer nicht existierenden Datei fälschlicherweise einen Fehler
     ✅ Hello
-    ⬜ HttpContent
-    ⬜ Loadmeter
+    ✅ HttpContent
+    ✅ Loadmeter
     ⬜ MysqlConnect
     ⬜ PdoConnect
     ⬜ Phpmodules
diff --git a/tests/200_diskfree.php b/tests/200_diskfree.php
index f7f3418..19b4cd8 100644
--- a/tests/200_diskfree.php
+++ b/tests/200_diskfree.php
@@ -2,6 +2,6 @@
 <?php
 
 echo "
-WHAT: Run check cert
+WHAT: Run check diskfree
 ";
-_exec("$AMCLI --ini='".__DIR__."/configs/cert.ini'");
+_exec("$AMCLI --ini='".__DIR__."/configs/diskfree.ini'");
diff --git a/tests/200_hello.php b/tests/200_hello.php
new file mode 100644
index 0000000..25f19ac
--- /dev/null
+++ b/tests/200_hello.php
@@ -0,0 +1,7 @@
+#!/usr/bin/env php
+<?php
+
+echo "
+WHAT: Run check Hello
+";
+_exec("$AMCLI --ini='".__DIR__."/configs/hello.ini'");
diff --git a/tests/200_httpcontent.php b/tests/200_httpcontent.php
new file mode 100644
index 0000000..8ac9b0d
--- /dev/null
+++ b/tests/200_httpcontent.php
@@ -0,0 +1,7 @@
+#!/usr/bin/env php
+<?php
+
+echo "
+WHAT: Run check httpcontent
+";
+_exec("$AMCLI --ini='".__DIR__."/configs/httpcontent.ini'");
diff --git a/tests/200_loadmeter.php b/tests/200_loadmeter.php
new file mode 100644
index 0000000..13875ce
--- /dev/null
+++ b/tests/200_loadmeter.php
@@ -0,0 +1,7 @@
+#!/usr/bin/env php
+<?php
+
+echo "
+WHAT: Run check loadmeter
+";
+_exec("$AMCLI --ini='".__DIR__."/configs/loadmeter.ini'");
diff --git a/tests/200_simple.php b/tests/200_simple.php
deleted file mode 100644
index e88d4eb..0000000
--- a/tests/200_simple.php
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-echo "
-WHAT: Run check Simple
-";
-_exec("$AMCLI --ini='".__DIR__."/configs/simple.ini'");
diff --git a/tests/configs/httpcontent.ini b/tests/configs/httpcontent.ini
new file mode 100644
index 0000000..093031b
--- /dev/null
+++ b/tests/configs/httpcontent.ini
@@ -0,0 +1,23 @@
+; =======================================================================
+;
+; APPMONITOR CLI CLIENT
+;
+; for the checks see its parameters
+; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html>
+;
+; =======================================================================
+
+
+; -----------------------------------------------------------------------
+; CHECKS
+; -----------------------------------------------------------------------
+
+["Http content"]
+description="Check word 'IML' in IML website"
+function="HttpContent"
+params='{
+    "url": "https://www.iml.unibe.ch/",
+    "bodycontains": "IML"
+}'
+
+; -----------------------------------------------------------------------
diff --git a/tests/configs/loadmeter.ini b/tests/configs/loadmeter.ini
new file mode 100644
index 0000000..33b21a9
--- /dev/null
+++ b/tests/configs/loadmeter.ini
@@ -0,0 +1,23 @@
+; =======================================================================
+;
+; APPMONITOR CLI CLIENT
+;
+; for the checks see its parameters
+; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html>
+;
+; =======================================================================
+
+
+; -----------------------------------------------------------------------
+; CHECKS
+; -----------------------------------------------------------------------
+
+["Load"]
+description="Loadmeter"
+function="Loadmeter"
+params='{
+    "warning": 3,
+    "error": 5
+}'
+
+; -----------------------------------------------------------------------
-- 
GitLab