Error run Django LiveStaticTestCase with Nginx reverse proxy using CircleCI


#1
  1. Our Stack: Django 1.9 + PostgreSQL 9.5 + Nginx + Selenium + Chrome
  2. Because our web application logic based on request domain name, so our Django LiveStaticTestCase running use Nginx as a reverse proxy server. And I already add Nginx as dependency in circle.yml by sudo apt-get install nginx, and replace the default conf by our own.
  3. The problem is that: the Django LiveStaticTestCase related test cause error on CircleCI , but when I debug used SSH, and repeat the test command, everything success.

TestCase error info on CircleCI:

`python -Wi manage.py test fenxiao --with-xunit --liveserver=127.0.0.1:8000 --xunit-file=$CIRCLE_TEST_REPORTS/django/nosetests.xml
nosetests account company order sitez cart fenxiao --with-xunit --xunit-file=/tmp/circle-junit.eItcVvW/django/nosetests.xml --verbosity=1
Creating test database for alias ‘default’…
…EEEE

ERROR: test_change_user_info (fenxiao.tests.test_e2e.ApplyViewTest)

Traceback (most recent call last):
File “/home/ubuntu/bazaar4/fenxiao/tests/test_e2e.py”, line 26, in setUp
self.browser = webdriver.Chrome()
File “/home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py”, line 69, in init
self.quit()
File “/home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py”, line 88, in quit
self.service.stop()
File “/home/ubuntu/virtualenvs/venv-system/lib/python2.7/site-packages/selenium/webdriver/chrome/service.py”, line 111, in stop
url_request.urlopen(“http://127.0.0.1:%d/shutdown” % self.port)
File “/opt/circleci/python/2.7.11/lib/python2.7/urllib2.py”, line 154, in urlopen
return opener.open(url, data, timeout)
File “/opt/circleci/python/2.7.11/lib/python2.7/urllib2.py”, line 431, in open
response = self._open(req, data)
File “/opt/circleci/python/2.7.11/lib/python2.7/urllib2.py”, line 449, in _open
’_open’, req)
File “/opt/circleci/python/2.7.11/lib/python2.7/urllib2.py”, line 409, in _call_chain
result = func(*args)
File “/opt/circleci/python/2.7.11/lib/python2.7/urllib2.py”, line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “/opt/circleci/python/2.7.11/lib/python2.7/urllib2.py”, line 1194, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File “/opt/circleci/python/2.7.11/lib/python2.7/httplib.py”, line 1057, in request
self._send_request(method, url, body, headers)
File “/opt/circleci/python/2.7.11/lib/python2.7/httplib.py”, line 1097, in _send_request
self.endheaders(body)
File “/opt/circleci/python/2.7.11/lib/python2.7/httplib.py”, line 1053, in endheaders
self._send_output(message_body)
File “/opt/circleci/python/2.7.11/lib/python2.7/httplib.py”, line 897, in _send_output
self.send(msg)
File “/opt/circleci/python/2.7.11/lib/python2.7/httplib.py”, line 859, in send
self.connect()
File “/opt/circleci/python/2.7.11/lib/python2.7/httplib.py”, line 836, in connect
self.timeout, self.source_address)
File “/opt/circleci/python/2.7.11/lib/python2.7/socket.py”, line 563, in create_connection
sock.settimeout(timeout)
File “/opt/circleci/python/2.7.11/lib/python2.7/socket.py”, line 228, in meth
return getattr(self._sock,name)(*args)
TypeError: a float is required
`


#2