From 63734f52ab1b4b2c17545b26fc41016d6bbd80bd Mon Sep 17 00:00:00 2001 From: Monitoring Plugins Development Team Date: Sat, 18 Jan 2014 03:40:24 -0500 Subject: Project rename initial commit. This is an initial take at renaming the project to Monitoring Plugins. It's not expected to be fully complete, and it is expected to break things (The perl module for instance). More testing will be required before this goes mainline. --- lib/tests/Makefile.am | 2 +- lib/tests/test_utils.c | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'lib/tests') diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am index 1af5891a..c0411ac5 100644 --- a/lib/tests/Makefile.am +++ b/lib/tests/Makefile.am @@ -28,7 +28,7 @@ endif AM_CFLAGS = -g -I$(top_srcdir)/lib -I$(top_srcdir)/gl $(tap_cflags) AM_LDFLAGS = $(tap_ldflags) -ltap -LDADD = $(top_srcdir)/lib/libnagiosplug.a $(top_srcdir)/gl/libgnu.a +LDADD = $(top_srcdir)/lib/libmonitoringplug.a $(top_srcdir)/gl/libgnu.a SOURCES = test_utils.c test_disk.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c index 79e1110a..7a1a1fa1 100644 --- a/lib/tests/test_utils.c +++ b/lib/tests/test_utils.c @@ -40,20 +40,20 @@ main (int argc, char **argv) plan_tests(150); - ok( this_nagios_plugin==NULL, "nagios_plugin not initialised"); + ok( this_monitoring_plugin==NULL, "monitoring_plugin not initialised"); np_init( "check_test", argc, argv ); - ok( this_nagios_plugin!=NULL, "nagios_plugin now initialised"); - ok( !strcmp(this_nagios_plugin->plugin_name, "check_test"), "plugin name initialised" ); + ok( this_monitoring_plugin!=NULL, "monitoring_plugin now initialised"); + ok( !strcmp(this_monitoring_plugin->plugin_name, "check_test"), "plugin name initialised" ); - ok( this_nagios_plugin->argc==argc, "Argc set" ); - ok( this_nagios_plugin->argv==argv, "Argv set" ); + ok( this_monitoring_plugin->argc==argc, "Argc set" ); + ok( this_monitoring_plugin->argv==argv, "Argv set" ); np_set_args(0,0); - ok( this_nagios_plugin->argc==0, "argc changed" ); - ok( this_nagios_plugin->argv==0, "argv changed" ); + ok( this_monitoring_plugin->argc==0, "argc changed" ); + ok( this_monitoring_plugin->argv==0, "argv changed" ); np_set_args(argc, argv); @@ -296,11 +296,11 @@ main (int argc, char **argv) diag( "You are probably running in wrong directory. Must run as ./test_utils" ); - this_nagios_plugin->argc=4; - this_nagios_plugin->argv[0] = "./test_utils"; - this_nagios_plugin->argv[1] = "here"; - this_nagios_plugin->argv[2] = "--and"; - this_nagios_plugin->argv[3] = "now"; + this_monitoring_plugin->argc=4; + this_monitoring_plugin->argv[0] = "./test_utils"; + this_monitoring_plugin->argv[1] = "here"; + this_monitoring_plugin->argv[2] = "--and"; + this_monitoring_plugin->argv[3] = "now"; temp_string = (char *) _np_state_generate_key(); ok(!strcmp(temp_string, "94b5e17bf5abf51cb15aff5f69b96f2f8dac5ecd"), "Got based on expected argv" ); @@ -320,16 +320,16 @@ main (int argc, char **argv) ok(temp_state_key==NULL, "temp_state_key initially empty"); - this_nagios_plugin->argc=1; - this_nagios_plugin->argv[0] = "./test_utils"; + this_monitoring_plugin->argc=1; + this_monitoring_plugin->argv[0] = "./test_utils"; np_enable_state(NULL, 51); - temp_state_key = this_nagios_plugin->state; + temp_state_key = this_monitoring_plugin->state; ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" ); ok( !strcmp(temp_state_key->name, "83d877b6cdfefb5d6f06101fd6fe76762f21792c"), "Got generated filename" ); np_enable_state("allowedchars_in_keyname", 77); - temp_state_key = this_nagios_plugin->state; + temp_state_key = this_monitoring_plugin->state; ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" ); ok( !strcmp(temp_state_key->name, "allowedchars_in_keyname"), "Got key name with valid chars" ); ok( !strcmp(temp_state_key->_filename, "/usr/local/nagios/var/check_test/allowedchars_in_keyname"), "Got internal filename" ); @@ -338,12 +338,12 @@ main (int argc, char **argv) /* Don't do this test just yet. Will die */ /* np_enable_state("bad^chars$in@here", 77); - temp_state_key = this_nagios_plugin->state; + temp_state_key = this_monitoring_plugin->state; ok( !strcmp(temp_state_key->name, "bad_chars_in_here"), "Got key name with bad chars replaced" ); */ np_enable_state("funnykeyname", 54); - temp_state_key = this_nagios_plugin->state; + temp_state_key = this_monitoring_plugin->state; ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" ); ok( !strcmp(temp_state_key->name, "funnykeyname"), "Got key name" ); @@ -367,9 +367,9 @@ main (int argc, char **argv) temp_state_key->_filename="var/statefile"; temp_state_data = np_state_read(); - ok( this_nagios_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not"); - ok( this_nagios_plugin->state->state_data->time==1234567890, "Got time" ); - ok( !strcmp((char *)this_nagios_plugin->state->state_data->data, "String to read"), "Data as expected" ); + ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not"); + ok( this_monitoring_plugin->state->state_data->time==1234567890, "Got time" ); + ok( !strcmp((char *)this_monitoring_plugin->state->state_data->data, "String to read"), "Data as expected" ); temp_state_key->data_version=53; temp_state_data = np_state_read(); @@ -379,7 +379,7 @@ main (int argc, char **argv) temp_state_key->_filename="var/nonexistant"; temp_state_data = np_state_read(); ok( temp_state_data==NULL, "Missing file gives NULL" ); - ok( this_nagios_plugin->state->state_data==NULL, "No state information" ); + ok( this_monitoring_plugin->state->state_data==NULL, "No state information" ); temp_state_key->_filename="var/oldformat"; temp_state_data = np_state_read(); @@ -426,7 +426,7 @@ main (int argc, char **argv) temp_state_data = np_state_read(); /* Check time is set to current_time */ ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time"); - ok(this_nagios_plugin->state->state_data->time-current_time<=1, "Has time generated from current time"); + ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time"); /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */ @@ -438,7 +438,7 @@ main (int argc, char **argv) np_cleanup(); - ok( this_nagios_plugin==NULL, "Free'd this_nagios_plugin" ); + ok( this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin" ); return exit_status(); } -- cgit v1.2.3-74-g34f1