gvalkov / jenkins-webapi

Python library for interacting with jenkins ci
http://jenkins-webapi.rtfd.org/
Other
16 stars 14 forks source link

Tests failing with jenkins 1.6x #14

Open hydrapolic opened 8 years ago

hydrapolic commented 8 years ago

Tested on Linux Gentoo.

> make test

from subprocess import check_call as run
run('py.test tests -xvs', shell=True)
============================= test session starts ==============================
platform linux2 -- Python 2.7.10, pytest-2.8.2, py-1.4.30, pluggy-0.3.1 -- /usr/bin/python2.7
cachedir: .cache
rootdir: /tmp/jenkins-webapi-0.5.0, inifile: 
plugins: cov-2.2.0
collecting ... collected 25 items

tests/test_jenkins.py::test_job_exists[env0]
[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
()
Bootsrapping Jenkins instance:
war:     http://mirrors.jenkins-ci.org/war/latest/jenkins.war
addr:    http://localhost:60888
destdir: /tmp/jenkins-webapi-0.5.0/tests/tmp/latest
cport:   60887

Mkdir: /tmp/jenkins-webapi-0.5.0/tests/tmp/latest
Downloading jenkins.war ...
curl -# -L http://mirrors.jenkins-ci.org/war/latest/jenkins.war > /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins.war
()
Extracing jenkins-cli.jar from jenkins.war ...
unzip -qqc /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins.war WEB-INF/jenkins-cli.jar > /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar
Starting Jenkins on localhost:60888 ... 
java -DJENKINS_HOME=/tmp/jenkins-webapi-0.5.0/tests/tmp/latest/home -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins.war \
     --httpListenAddress=localhost \
     --httpPort=60888 \
     --controlPort=60887
()
Waiting for Jenkins to start ...
curl --retry 5 -s localhost:60888 &>/dev/null
curl --retry 5 -s localhost:60888 &>/dev/null
curl --retry 5 -s localhost:60888 &>/dev/null
curl --retry 5 -s localhost:60888 &>/dev/null
Removing all jobs ...

Listing jobs with jenkins-cli ...
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 list-jobs

Removing job "[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 delete-job [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous

Creating job "test-1" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job test-1
PASSED
Removing job "test-1" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 delete-job test-1

tests/test_jenkins.py::test_job_exists_fail[env0] PASSED
tests/test_jenkins.py::test_job_exists_auth_fail[env0] [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous

Creating job "test-1" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job test-1
PASSED
Removing job "test-1" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 delete-job test-1

tests/test_jenkins.py::test_job_create[env0-test-job] 
Determining if job "test-job" exists with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 get-job test-job
PASSED
Removing job "test-job" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 delete-job test-job

tests/test_jenkins.py::test_job_create[env0-test job spaces] 
Determining if job "test job spaces" exists with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 get-job test job spaces
PASSED
Removing job "test job spaces" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 delete-job test job spaces

tests/test_jenkins.py::test_job_create[env0-\xd0\xbf\xd1\x80\xd0\xbe\xd0\xb1\xd0\xb0-\xd0\xb3\xd1\x80\xd0\xb5\xd1\x88\xd0\xba\xd0\xb0] 
Determining if job "пÑоба-гÑеÑка" exists with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 get-job пÑоба-гÑеÑка
PASSED
Removing job "пÑоба-гÑеÑка" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 delete-job пÑоба-гÑеÑка

tests/test_jenkins.py::test_job_create_fail[test-job-env0] [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous

Creating job "test-job" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job test-job
PASSED
tests/test_jenkins.py::test_job_create_fail[test job spaces-env0] [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous

Creating job "test job spaces" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job test job spaces
PASSED
tests/test_jenkins.py::test_job_create_fail[\xd0\xbf\xd1\x80\xd0\xbe\xd0\xb1\xd0\xb0-\xd0\xb3\xd1\x80\xd0\xb5\xd1\x88\xd0\xba\xd0\xb0-env0] [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous

Creating job "пÑоба-гÑеÑка" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job пÑоба-гÑеÑка
PASSED
tests/test_jenkins.py::test_job_copy[env0] [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous

Creating job "job-copy-src" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job job-copy-src

Creating job "job-copy-dst-1" with jenkins-cli
java -jar /tmp/jenkins-webapi-0.5.0/tests/tmp/latest/jenkins-cli.jar -s http://localhost:60888 create-job job-copy-dst-1
FAILEDSending shutdown signal ...
echo 0 | nc localhost 60887 &>/dev/null

=================================== FAILURES ===================================
_____________________________ test_job_copy[env0] ______________________________

api = Jenkins('http://localhost:60888/')
ref = <tests.refapi.JenkinsCLI instance at 0x7f8fe2867a28>

    def test_job_copy(api, ref):
        ref.job_create('job-copy-src', job_config_enc)
        ref.job_create('job-copy-dst-1', job_config_enc)

        assert api.job_copy('job-copy-src', 'job-copy-dst').exists
>       assert api.job_config('job-copy-src').strip() == api.job_config('job-copy-dst').strip()
E       assert '<?xml versio.../>\n</project>' == '<?xml version.../>\n</project>'
E         - <?xml version="1.0" encoding="UTF-8"?><project>
E         ?               ^   ^          ^     ^  ---------
E         + <?xml version='1.0' encoding='UTF-8'?>
E         ?               ^   ^          ^     ^
E         + <project>
E             <actions/>
E         -   <description/>
E         +   <description></description>
E             <keepDependencies>false</keepDependencies>
E         Detailed information truncated (12 more lines), use "-vv" to show

tests/test_jenkins.py:55: AssertionError
!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
===================== 1 failed, 9 passed in 58.47 seconds ======================
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'py.test tests -xvs' returned non-zero exit status 2
Makefile:39: recipe for target 'test' failed
make: *** [test] Error 1
hydrapolic commented 8 years ago

I've tested with older Jenkins 1.596.3 and it worked. Can you please try with newer LTS release?