diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-01-07 11:25:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 11:25:47 +0100 |
| commit | 558aca48ed764c46fce74c53312ce0d445ee3953 (patch) | |
| tree | a90ce1e2f9916093bc82bf0cede4fd5b85b83f5e /plugins/tests/test_check_swap.c | |
| parent | e445a386f8ad1166b05fcdfdb5b9cde4622a8632 (diff) | |
| parent | a8ac865e67cdd88657ac6ece4524c09360dd824e (diff) | |
| download | monitoring-plugins-558aca48ed764c46fce74c53312ce0d445ee3953.tar.gz | |
Merge branch 'master' into fix_check_http_state_regex
Diffstat (limited to 'plugins/tests/test_check_swap.c')
| -rw-r--r-- | plugins/tests/test_check_swap.c | 23 |
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 | |||
| 5 | int verbose = 0; | ||
| 6 | |||
| 7 | void print_usage(void) {} | ||
| 8 | void print_help(swap_config config) { | ||
| 9 | (void) config; | ||
| 10 | } | ||
| 11 | |||
| 12 | const char *progname = "test_check_swap"; | ||
| 13 | |||
| 14 | int 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 | } | ||
