diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-12-19 11:28:35 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-12-20 10:02:47 +0100 |
commit | 6fcbbaafc4bae79d4e674a2cf7f1d87d5a471603 (patch) | |
tree | bcce5da6a2b96b7f288d948db0584fe8420ce824 /plugins/tests | |
parent | 2dec5182c508bd3cc286b4649836ead51aec50ef (diff) | |
download | monitoring-plugins-6fcbbaafc4bae79d4e674a2cf7f1d87d5a471603.tar.gz |
Implement first unit test for check_swap
Diffstat (limited to 'plugins/tests')
-rw-r--r-- | plugins/tests/test_check_swap.c | 21 | ||||
-rw-r--r-- | plugins/tests/test_check_swap.t | 6 |
2 files changed, 27 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..42ac0086 --- /dev/null +++ b/plugins/tests/test_check_swap.c | |||
@@ -0,0 +1,21 @@ | |||
1 | |||
2 | #include "../check_swap.d/check_swap.h" | ||
3 | #include "../../tap/tap.h" | ||
4 | |||
5 | void print_usage() {}; | ||
6 | void print_help(swap_config config) { | ||
7 | (void) config; | ||
8 | }; | ||
9 | |||
10 | const char *progname = "test_check_swap"; | ||
11 | |||
12 | int main() { | ||
13 | |||
14 | swap_config config = swap_config_init(); | ||
15 | |||
16 | swap_result test_data = get_swap_data(config); | ||
17 | |||
18 | plan_tests(1); | ||
19 | |||
20 | ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data"); | ||
21 | } | ||
diff --git a/plugins/tests/test_check_swap.t b/plugins/tests/test_check_swap.t new file mode 100644 index 00000000..97c651a8 --- /dev/null +++ b/plugins/tests/test_check_swap.t | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/usr/bin/perl | ||
2 | use Test::More; | ||
3 | if (! -e "./test_check_swap") { | ||
4 | plan skip_all => "./test_swap not compiled - please enable libtap library to test"; | ||
5 | } | ||
6 | exec "./test_check_swap"; | ||