From 6b5f3e81558e37a3c4621ad5d705f4d2876c440c Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Tue, 4 Mar 2025 10:52:11 +0100 Subject: [PATCH] sqlite check added/ tested --- TODO.md | 6 +++++- tests/200_sqliteconnect.php | 7 +++++++ tests/configs/sqliteconnect.ini | 28 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/200_sqliteconnect.php create mode 100644 tests/configs/sqliteconnect.ini diff --git a/TODO.md b/TODO.md index a5d280f..73f99e7 100644 --- a/TODO.md +++ b/TODO.md @@ -6,6 +6,10 @@ was ich so sehe ... ✅ `--ini=<FILE>` bei relativem Pfad ist relativ zum Binary --> nicht ins eigene Verzeichnis wechseln +⬜ handle non-JSON Response (z.B. Syntaxfehler in der INI) --> Festlegen, was die aufrufende Instanz machen soll + +⬜ optional: dynamische Parameter aus Umgebungsvariablen / Parsing aus Configs (was immer geht: INI per hooks/template/ file generieren.) + ⬜ Dokumentation ⬜ Code aufräumen @@ -30,7 +34,7 @@ was ich so sehe ... ✅ Ping ✅ PortTcp -> sockets Modul im Binary hinzugefügt. ✅ Simple - ⬜ SqliteConnect + ✅ SqliteConnect ⬜ parent Option testen diff --git a/tests/200_sqliteconnect.php b/tests/200_sqliteconnect.php new file mode 100644 index 0000000..ab5fd26 --- /dev/null +++ b/tests/200_sqliteconnect.php @@ -0,0 +1,7 @@ +#!/usr/bin/env php +<?php + +echo " +WHAT: Run check sqlite connect +"; +_exec("$AMCLI --ini='".__DIR__."/configs/sqliteconnect.ini'"); diff --git a/tests/configs/sqliteconnect.ini b/tests/configs/sqliteconnect.ini new file mode 100644 index 0000000..5d24843 --- /dev/null +++ b/tests/configs/sqliteconnect.ini @@ -0,0 +1,28 @@ +; ======================================================================= +; +; APPMONITOR CLI CLIENT +; +; for the checks see its parameters +; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html> +; +; ======================================================================= + + +; ----------------------------------------------------------------------- +; CHECKS +; ----------------------------------------------------------------------- + +["Sqliteconnect ok test"] +description="Test Sqlite database connection" +function="Sqliteconnect" +params='{ + "db": "/home/axel/data/docker/ciserver/public_html/valuestore/data/versioncache.db" +}' +["Sqliteconnect fail test"] +description="Test Sqlite database failure" +function="Sqliteconnect" +params='{ + "db": "/tmp/non-existing-file.sqlite3" +}' + +; ----------------------------------------------------------------------- -- GitLab