jenkinsapi
jenkinsapi copied to clipboard
node.get_response_time() and some other function can't get right value
ISSUE TYPE
- Bug Report
Jenkinsapi 0.3.11
Jenkins 2.229
SUMMARY
node.get_response_time()
, node.get_temp_path()
and some other functions can't get right value.why unittests are passed? Did unittests run?
I can fix this if this is sure a bug.
EXPECTED RESULTS
node.get_response_time()
will get NODE_DATA['monitorData']['hudson.node_monitors.ResponseTimeMonitor']'[average']
ACTUAL RESULTS
KeyError: 'average'
USEFUL INFORMATION
These functions all invoke get_monitor(<monitor_name>)
, with default parameter poll_monitor=True. We firstly get monitor_data, and then get the subitem value.
While the source code tree did not has subitem info, so Jenkins api will not return subitems data.
if poll_monitor:
# polling as monitors like response time can be updated
monitor_data = self.poll(tree=monitor_data_key)[monitor_data_key]
for example, following code,
value of monitor_data is 'hudson.node_monitors.ResponseTimeMonitor$Data'
, no subitems data.
def get_response_time(self):
"""
Returns the node's average response time.
"""
monitor_data = self.get_monitor('ResponseTimeMonitor')
return monitor_data['average']
If you could fix that, please do. I will accept pull request.
@lechat I have created a PR. But CI build error. How can I rerun the build?