|
@@ -38,7 +38,7 @@ main (int argc, char **argv)
|
|
|
state_data *temp_state_data;
|
|
state_data *temp_state_data;
|
|
|
time_t current_time;
|
|
time_t current_time;
|
|
|
|
|
|
|
|
- plan_tests(172);
|
|
|
|
|
|
|
+ plan_tests(185);
|
|
|
|
|
|
|
|
ok( this_nagios_plugin==NULL, "nagios_plugin not initialised");
|
|
ok( this_nagios_plugin==NULL, "nagios_plugin not initialised");
|
|
|
|
|
|
|
@@ -182,6 +182,21 @@ main (int argc, char **argv)
|
|
|
ok( get_status(30.0001, thresholds) == STATE_WARNING, "30.0001 - warning");
|
|
ok( get_status(30.0001, thresholds) == STATE_WARNING, "30.0001 - warning");
|
|
|
ok( get_status(69, thresholds) == STATE_CRITICAL, "69 - critical");
|
|
ok( get_status(69, thresholds) == STATE_CRITICAL, "69 - critical");
|
|
|
|
|
|
|
|
|
|
+ rc = _set_thresholds(&thresholds, "-10:-2", "-30:20");
|
|
|
|
|
+ ok( rc == 0, "Thresholds ('-30:20', '-10:-2') set");
|
|
|
|
|
+ ok( thresholds->warning->start == -10, "Warning start set correctly");
|
|
|
|
|
+ ok( thresholds->warning->end == -2, "Warning end set correctly");
|
|
|
|
|
+ ok( thresholds->critical->start == -30, "Critical start set correctly");
|
|
|
|
|
+ ok( thresholds->critical->end == 20, "Critical end set correctly");
|
|
|
|
|
+ ok( get_status(-31, thresholds) == STATE_CRITICAL, "-31 - critical");
|
|
|
|
|
+ ok( get_status(-29, thresholds) == STATE_WARNING, "-29 - warning");
|
|
|
|
|
+ ok( get_status(-11, thresholds) == STATE_WARNING, "-11 - warning");
|
|
|
|
|
+ ok( get_status(-10, thresholds) == STATE_OK, "-10 - ok");
|
|
|
|
|
+ ok( get_status(-2, thresholds) == STATE_OK, "-2 - ok");
|
|
|
|
|
+ ok( get_status(-1, thresholds) == STATE_WARNING, "-1 - warning");
|
|
|
|
|
+ ok( get_status(19, thresholds) == STATE_WARNING, "19 - warning");
|
|
|
|
|
+ ok( get_status(21, thresholds) == STATE_CRITICAL, "21 - critical");
|
|
|
|
|
+
|
|
|
char *test;
|
|
char *test;
|
|
|
test = np_escaped_string("bob\\n");
|
|
test = np_escaped_string("bob\\n");
|
|
|
ok( strcmp(test, "bob\n") == 0, "bob\\n ok");
|
|
ok( strcmp(test, "bob\n") == 0, "bob\\n ok");
|
|
@@ -438,9 +453,9 @@ main (int argc, char **argv)
|
|
|
|
|
|
|
|
np_cleanup();
|
|
np_cleanup();
|
|
|
|
|
|
|
|
- ok( this_nagios_plugin==NULL, "Free'd this_nagios_plugin" );
|
|
|
|
|
|
|
+ ok(this_nagios_plugin==NULL, "Free'd this_nagios_plugin" );
|
|
|
|
|
|
|
|
- ok( np_suid() == FALSE, "test aren't suid" );
|
|
|
|
|
|
|
+ ok(np_suid() == FALSE, "Tests aren't suid" );
|
|
|
|
|
|
|
|
/* base states with random case */
|
|
/* base states with random case */
|
|
|
char *states[] = {
|
|
char *states[] = {
|