summaryrefslogtreecommitdiffstats
path: root/plugins/tests/test_check_swap.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-12-29 21:23:38 +0100
committerGitHub <noreply@github.com>2024-12-29 21:23:38 +0100
commit39680498ee0987a5e0eb203a2c0539aa1fa94d39 (patch)
tree51bf00a9e8a9ad9d1b9bdd59504b2b1ad2b0583b /plugins/tests/test_check_swap.c
parente301a9410d7f5f9f864086696eb2003d08512b2b (diff)
parent54529b601385ebf3bd0fca855e8def62ec5b6527 (diff)
downloadmonitoring-plugins-39680498ee0987a5e0eb203a2c0539aa1fa94d39.tar.gz
Merge pull request #1976 from RincewindsHat/check_swap_again
Refactor check_swap
Diffstat (limited to 'plugins/tests/test_check_swap.c')
-rw-r--r--plugins/tests/test_check_swap.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/tests/test_check_swap.c b/plugins/tests/test_check_swap.c
new file mode 100644
index 00000000..b85fb4ad
--- /dev/null
+++ b/plugins/tests/test_check_swap.c
@@ -0,0 +1,23 @@
1
2#include "../check_swap.d/check_swap.h"
3#include "../../tap/tap.h"
4
5int verbose = 0;
6
7void print_usage(void) {}
8void print_help(swap_config config) {
9 (void) config;
10}
11
12const char *progname = "test_check_swap";
13
14int main(void) {
15 swap_result test_data = getSwapFromProcMeminfo("./var/proc_meminfo");
16
17 plan_tests(4);
18
19 ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data");
20 ok(test_data.metrics.total == 34233905152, "Is the total Swap correct");
21 ok(test_data.metrics.free == 34233905152, "Is the free Swap correct");
22 ok(test_data.metrics.used == 0, "Is the used Swap correct");
23}