[openstack-dev] [devstack][CI] Etcd server setuped in devstack script can not be reached in CI unit tests

Clark Boylan cboylan at sapwetik.org
Wed Oct 19 03:37:53 UTC 2016


On Tue, Oct 18, 2016, at 07:08 PM, Wenzhi Yu (yuywz) wrote:
> Hi all,
> 
> I intended to use etcd as data store for Zun project. So I installed
> docker and started a docker container with an etcd server running in it
> using
> devstack script.  The etcd server listens on 127.0.0.1:2379 for client
> requests. And per CI log [1] the container had been started successfully
> and
> functioned well (I added some test code and etcd server is available on
> 127.0.0.1:2379).
> 
> But during the execution of unit test cases, the connection to
> 127.0.0.1:2379 became inavailable [2], all the cases tried to connect to
> etcd server
> failed. I did some investigation and found that the test cases were
> running in an isolated network environment (maybe within an container?).
> So the etcd server can not be reached via 127.0.0.1:2379 during test run.
> 
> I intended to configure etcd server to listen on an IP address which can
> be reached from the test envrionment, but I realized that even if I did
> that,
> it's not easy to query that IP address in test cases. An alternative
> method is to forward the request sent to 127.0.0.1:2379 of test
> environment to
> corresponding socket of the environment inwhich the etcd container is
> running.
> 
> Now I have no idea how to deal with this issue, please help me out!
> Thanks in advance!
> 
> [1]http://paste.openstack.org/show/586299/
> [2]http://paste.openstack.org/show/586310/

It looks like this is the change [3] in question. I think the problem is
that the unittests expect to run alongside devstack but this is not the
case. Unittests, linting, doc builds, and so on are run on fairly
barebone instances. The process to run these jobs is to fetch the
correct git ref, install any system deps using bindep, then run tox.
More information on how this works can be found at [4].

Etcd is in universe on Ubuntu Xenial so you should be able to add it to
your bindep list and get it for the python2.7 and python3.5 unittest
jobs. Or you can do this testing in your devstack job.

[3] https://review.openstack.org/#/c/364855/28
[4] https://governance.openstack.org/reference/cti/python_cti.html

Clark



More information about the OpenStack-dev mailing list