python-jenkins/tests
Tomas Janousek b5a8b7035e Request multiple folder levels at once in get_all_jobs
On our Jenkins instance with almost a hundred folders, JJB update
stalls for quite a while because it calls get_all_jobs. When invoked
locally at the Jenkins master, it's a matter of seconds, on a fast
broadband link and VPN, it's 2 minutes, and on a train it's easily 10
minutes.

But there's trick!

    curl \
        --show-error --silent --fail \
        --user : --negotiate \
        --get \
        --data-urlencode \
            tree=jobs\[url\,name\,jobs\[url\,name\,jobs\[url\,name\,\
            jobs\[url\,name\,jobs\[url\,name\,jobs\[url\,name\,\
            jobs\[url\,name\,jobs\[url\,name\,jobs\[url\,name\,\
            jobs\[url\,name\,jobs\]\]\]\]\]\]\]\]\]\]
        https://jenkins.example.com/api/json

This returns almost instantly.

And it gets better: if we fail to correctly guess the nesting level
necessary, Jenkins returns

    …, "jobs": [{}, {}, …], …

so we can easily detect that we need to recurse deeper.

Change-Id: I7268259149e4bc8939c512a112c7e6ec1908224f
2018-10-17 18:06:56 +02:00
..
jobs Request multiple folder levels at once in get_all_jobs 2018-10-17 18:06:56 +02:00
__init__.py Fixes for this bug. 2012-05-17 16:10:00 +01:00
base.py Test requested URLs in test_getall 2018-10-17 18:06:56 +02:00
helper.py Check for 'Location' header in the response 2018-06-25 12:59:38 +03:00
test_build.py Add functions to retrieve more data from Jenkins 2018-04-25 13:30:29 +01:00
test_credential.py Add folder credential support 2018-08-03 06:39:13 +03:00
test_info.py Migration to using requests 2018-02-12 11:16:54 +00:00
test_jenkins.py Allow adding extra HTTP headers to Jenkins requests 2018-09-12 13:42:23 +02:00
test_jenkins_sockets.py Revert "detect and respect http redirects" 2018-08-24 13:12:38 -04:00
test_job_folder.py Adds Cloudbees folder plugin support 2015-09-21 18:25:35 +01:00
test_node.py Update URLS that require depth or tree filters 2018-05-28 10:17:26 +01:00
test_plugins.py Revert "detect and respect http redirects" 2018-08-24 13:12:38 -04:00
test_promotion.py Migration to using requests 2018-02-12 11:16:54 +00:00
test_queue.py Update URLS that require depth or tree filters 2018-05-28 10:17:26 +01:00
test_quiet_down.py Migration to using requests 2018-02-12 11:16:54 +00:00
test_rest_endpoints.py Update URLS that require depth or tree filters 2018-05-28 10:17:26 +01:00
test_script.py Revert "detect and respect http redirects" 2018-08-24 13:12:38 -04:00
test_version.py Migration to using requests 2018-02-12 11:16:54 +00:00
test_view.py Added folder support in views keeping backward compatibility and added tests for it. 2018-04-05 22:57:34 +02:00
test_whoami.py Update URLS that require depth or tree filters 2018-05-28 10:17:26 +01:00