Work on 2014-07-30

Tags: tag

Last time I worked on Kallithea’s CI, I got some errors. On a fresh Ubuntu 14.04 VM without docker, I get the following test results:

In a Virtual Machine

sqlite: 0 errors, 2 skipped

mysql: 0 errors, 2 skipped

postgresql: 1 error, 2 skipped

details:

======================================================================
ERROR: test_index_with_anonymous_access_disabled (kallithea.tests.functional.test_home.TestHomeController)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/packer/src/kallithea-pg/kallithea/tests/functional/test_home.py", line 43, in test_index_with_anonymous_access_disabled
    status=302)
  File "/home/packer/src/kallithea/.venv/local/lib/python2.7/site-packages/WebTest-1.4.3-py2.7.egg/webtest/app.py", line 759, in get
    expect_errors=expect_errors)
  File "/home/packer/src/kallithea/.venv/local/lib/python2.7/site-packages/WebTest-1.4.3-py2.7.egg/webtest/app.py", line 1121, in do_request
    self._check_status(status, res)
  File "/home/packer/src/kallithea/.venv/local/lib/python2.7/site-packages/WebTest-1.4.3-py2.7.egg/webtest/app.py", line 1160, in _check_status
    "Bad response: %s (not %s)", res_status, status)
AppError: Bad response: 200 OK (not 302)

----------------------------------------------------------------------
Ran 1482 tests in 311.450s

FAILED (SKIP=2, errors=1)

In a Docker Container

sqlite

I’m betting that these messages are a canary that will help figure out the sqlite failures:

kallithea_1 | not trusting file /code/.hg/hgrc from untrusted user 1000, group 1000
kallithea_1 | not trusting file /tmp/rc_test_lPm4Rl/vcs_test_hg/.hg/hgrc from untrusted user 502, group root
kallithea_1 | not trusting file /tmp/rc_test_lPm4Rl/vcs_test_hg/.hg/hgrc from untrusted user 502, group root
kallithea_1 | not trusting file /tmp/rc_test_lPm4Rl/vcs_test_hg/.hg/hgrc from untrusted user 502, group root

Here’s the full list of error details:

kallithea_1 | ======================================================================
kallithea_1 | ERROR: test_index_with_anonymous_access_disabled (kallithea.tests.functional.test_home.TestHomeController)
kallithea_1 | ----------------------------------------------------------------------
kallithea_1 | Traceback (most recent call last):
kallithea_1 |   File "/code/kallithea/tests/functional/test_home.py", line 43, in test_index_with_anonymous_access_disabled
kallithea_1 |     status=302)
kallithea_1 |   File "/usr/local/lib/python2.7/dist-packages/webtest/app.py", line 759, in get
kallithea_1 |     expect_errors=expect_errors)
kallithea_1 |   File "/usr/local/lib/python2.7/dist-packages/webtest/app.py", line 1121, in do_request
kallithea_1 |     self._check_status(status, res)
kallithea_1 |   File "/usr/local/lib/python2.7/dist-packages/webtest/app.py", line 1160, in _check_status
kallithea_1 |     "Bad response: %s (not %s)", res_status, status)
kallithea_1 | AppError: Bad response: 200 OK (not 302)
kallithea_1 |
kallithea_1 | ======================================================================
kallithea_1 | FAIL: test_create_non_ascii (kallithea.tests.functional.test_admin_repos.TestAdminReposControllerGIT)
kallithea_1 | ----------------------------------------------------------------------
kallithea_1 | Traceback (most recent call last):
kallithea_1 |   File "/code/kallithea/tests/functional/test_admin_repos.py", line 103, in test_create_non_ascii
kallithea_1 |     self.assertEqual(response.json, {u'result': True})
kallithea_1 | AssertionError: {u'result': False} != {u'result': True}
kallithea_1 | - {u'result': False}
kallithea_1 | ?             ^^^^
kallithea_1 |
kallithea_1 | + {u'result': True}
kallithea_1 | ?             ^^^
kallithea_1 |
kallithea_1 |     """Fail immediately, with the given message."""
kallithea_1 | >>  raise self.failureException("{u'result': False} != {u'result': True}\n- {u'result': False}\n?             ^^^^\n\n+ {u'result': True}\n?             ^^^\n")
kallithea_1 |
kallithea_1 |
kallithea_1 | ======================================================================
kallithea_1 | FAIL: test_delete_non_ascii (kallithea.tests.functional.test_admin_repos.TestAdminReposControllerGIT)
kallithea_1 | ----------------------------------------------------------------------
kallithea_1 | Traceback (most recent call last):
kallithea_1 |   File "/code/kallithea/tests/functional/test_admin_repos.py", line 420, in test_delete_non_ascii
kallithea_1 |     self.assertEqual(response.json, {u'result': True})
kallithea_1 | AssertionError: {u'result': False} != {u'result': True}
kallithea_1 | - {u'result': False}
kallithea_1 | ?             ^^^^
kallithea_1 |
kallithea_1 | + {u'result': True}
kallithea_1 | ?             ^^^
kallithea_1 |
kallithea_1 |     """Fail immediately, with the given message."""
kallithea_1 | >>  raise self.failureException("{u'result': False} != {u'result': True}\n- {u'result': False}\n?             ^^^^\n\n+ {u'result': True}\n?             ^^^\n")
kallithea_1 |
kallithea_1 |
kallithea_1 | ======================================================================
kallithea_1 | FAIL: test_create_non_ascii (kallithea.tests.functional.test_admin_repos.TestAdminReposControllerHG)
kallithea_1 | ----------------------------------------------------------------------
kallithea_1 | Traceback (most recent call last):
kallithea_1 |   File "/code/kallithea/tests/functional/test_admin_repos.py", line 103, in test_create_non_ascii
kallithea_1 |     self.assertEqual(response.json, {u'result': True})
kallithea_1 | AssertionError: {u'result': False} != {u'result': True}
kallithea_1 | - {u'result': False}
kallithea_1 | ?             ^^^^
kallithea_1 |
kallithea_1 | + {u'result': True}
kallithea_1 | ?             ^^^
kallithea_1 |
kallithea_1 |     """Fail immediately, with the given message."""
kallithea_1 | >>  raise self.failureException("{u'result': False} != {u'result': True}\n- {u'result': False}\n?             ^^^^\n\n+ {u'result': True}\n?             ^^^\n")
kallithea_1 |
kallithea_1 |
kallithea_1 | ======================================================================
kallithea_1 | FAIL: test_delete_non_ascii (kallithea.tests.functional.test_admin_repos.TestAdminReposControllerHG)
kallithea_1 | ----------------------------------------------------------------------
kallithea_1 | Traceback (most recent call last):
kallithea_1 |   File "/code/kallithea/tests/functional/test_admin_repos.py", line 420, in test_delete_non_ascii
kallithea_1 |     self.assertEqual(response.json, {u'result': True})
kallithea_1 | AssertionError: {u'result': False} != {u'result': True}
kallithea_1 | - {u'result': False}
kallithea_1 | ?             ^^^^
kallithea_1 |
kallithea_1 | + {u'result': True}
kallithea_1 | ?             ^^^
kallithea_1 |
kallithea_1 |     """Fail immediately, with the given message."""
kallithea_1 | >>  raise self.failureException("{u'result': False} != {u'result': True}\n- {u'result': False}\n?             ^^^^\n\n+ {u'result': True}\n?             ^^^\n")
kallithea_1 |
kallithea_1 |
kallithea_1 | ----------------------------------------------------------------------
kallithea_1 | Ran 1479 tests in 281.475s
kallithea_1 |
kallithea_1 | FAILED (SKIP=2, errors=1, failures=4)

Boo… file permissions were not the problem.

I just removed the following from my fig config:

volumes:
 - .:/code/

And added the following to my Dockerfile:

RUN useradd -d /home/kallithea -m -s /bin/bash -u 2000 kallithea
RUN chown -R kallithea /code
USER kallithea

… to ensure that there was no weirdness induced from running as root and running against files that were owned by a different UID than the test process, and I got the same four errors. Something’s up when running in this container.

All the failing tests include the string “non_ascii” in their names.

Let’s see what locale tells us on the virtual machine:

packer@example:~/src/kallithea$ locale
LANG=en_US.utf8
LANGUAGE=en_US:
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=

… and in the Docker container:

kallithea@56a8a9afa48d:/code$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

The Docker container doesn’t include en_US.utf8, but it does include C.UTF-8… let’s give that a spin.

kallithea_1 | Ran 1479 tests in 286.144s
kallithea_1 |
kallithea_1 | OK (SKIP=2)
kallithea_kallithea_1 exited with code 0

WOO!