summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShubhendu Tripathi <shtripat@redhat.com>2014-05-06 14:39:42 +0530
committerSahina Bose <sabose@redhat.com>2014-05-20 00:20:50 -0700
commit0c6651331d3a8fc867a1799b18baed4c0789ba69 (patch)
treec09a84fd2f806b1a5da4e10ac2884f39cd3ba917 /tests
parent25a9105f9583cf165526db0c24c67bd12c4336fe (diff)
nagios-server-addons: NRPE command with timeout
Introduced a utility method to return a NRPE base command with timeout set externally. Currently if a plugin internally executes NRPE to get the details from the node, there is no mechanism that timeout could be set to more than 10 sec. This method provides the NRPE command with timeout (if passed). This is required for some of the NRPE calls where gluster commands get executed and they might take more time. All the plugins, which execute a NRPE within, can provide optional command line argument for timeout, and same can be used for forming the proper NRPE call with timeout value. Change-Id: Id97624df743664a320a585acc4a85cfcf64d0a07 Signed-off-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-on: http://review.gluster.org/7682 Reviewed-by: Sahina Bose <sabose@redhat.com> Tested-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_discovery.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_discovery.py b/tests/test_discovery.py
index 5e03732..a3d1347 100644
--- a/tests/test_discovery.py
+++ b/tests/test_discovery.py
@@ -16,14 +16,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
-from plugins import discovery
+from plugins import discovery, server_utils
from glusternagios.glustercli import HostStatus
from testrunner import PluginsTestCase as TestCaseBase
class TestDiscovery(TestCaseBase):
def _mockExecNRPECommand(self, host, command, arguments=None,
- jsonOutput=True):
+ timeout=None):
if command == "discover_volume_list":
return self._getVolumeNames()
elif command == "discover_volume_info":
@@ -96,8 +96,10 @@ class TestDiscovery(TestCaseBase):
# Method to test the discoverCluster() method
def testDiscoverCluster(self):
- discovery.execNRPECommand = self._mockExecNRPECommand
+ server_utils.execNRPECommand = self._mockExecNRPECommand
clusterName = "test-cluster"
host = "172.16.53.1"
- clusterdata = discovery.discoverCluster(host, clusterName)
+ clusterdata = discovery.discoverCluster(host,
+ clusterName,
+ timeout=None)
self._verifyClusterData(clusterdata, clusterName, host)