Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node.get_response_time() and some other function can't get right value #776

Open
hummerstudio opened this issue Apr 18, 2020 · 2 comments
Open

Comments

@hummerstudio
Copy link

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']
@lechat
Copy link
Collaborator

lechat commented Apr 18, 2020

If you could fix that, please do. I will accept pull request.

@hummerstudio
Copy link
Author

@lechat I have created a PR. But CI build error. How can I rerun the build?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants