From 08c3f0f7379eabe51cd965d0dc35626d8939ae27 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:06:11 +0100 Subject: Add test proc/meminfo file and corresponding test --- plugins/tests/test_check_swap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/tests/test_check_swap.c') diff --git a/plugins/tests/test_check_swap.c b/plugins/tests/test_check_swap.c index 42ac0086..86ab188f 100644 --- a/plugins/tests/test_check_swap.c +++ b/plugins/tests/test_check_swap.c @@ -13,9 +13,12 @@ int main() { swap_config config = swap_config_init(); - swap_result test_data = get_swap_data(config); + swap_result test_data = getSwapFromProcMeminfo(config, "./var/proc_meminfo"); - plan_tests(1); + plan_tests(4); ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data"); + ok(test_data.metrics.total == 34233905152, "Is the total Swap correct"); + ok(test_data.metrics.free == 34231021568, "Is the free Swap correct"); + ok(test_data.metrics.used == 0, "Is the used Swap correct"); } -- cgit v1.2.3-74-g34f1