I've tried to replicate the bitbucket pipeline build locally - and can get it working so my integration tests are running and passing with Docker. However once I push to Bitbucket those same tests fail.
I think the answer is something simple - I just can't figure it out.
It's a Django project/app and I use Selenium to launch firefox and chrome browsers to test against.
I have the following `docker-compose.yml` and this works locally:
The `python.dock` file is very simple:
SHELL ["/bin/bash", "-c"]
RUN pip install virtualenv
CMD ["tail", "-F", "-n0", "/etc/hosts"]
Then I launch an interactive bash shell for that container and install requirements and run pytest.
My `bitbucket-pipelines.yml` file is also pretty simple/straightforward:
name: Build project & run pytest
script: # Modify the commands below to build your repository.
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- apt-get install gcc libc-dev g++ libffi-dev libxml2 unixodbc-dev gnupg2 -y
- pip install -r requirements-dev.txt
I utilize `pytest` for my testing and in the setup of the browser for my tests it looks like this:
HUB_URL = "http://hub:4444/wd/hub"
chrome_capabilities = DesiredCapabilities.CHROME.copy()
browser = webdriver.Remote(
This launches the appropriate browser and my tests all pass no problem using Docker locally. I believe it's because I use `links` to attach the two containers to each other - so I can use the service name in the URL and it gets routed appropriately.
When I run my CI on Bitbucket the tests fail.
This is the failure message:
> conn = connection.create_connection(
(self._dns_host, self.port), self.timeout, **extra_kw
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
address = ('hub', 4444), timeout = <object object at 0x7f8bd0757630>
source_address = None, socket_options = [(6, 1, 1)]
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection.
An host of '' or port 0 tells the OS to use the default.
host, port = address
host = host.strip("")
err = None
# Using the value from allowed_gai_family() in the context of getaddrinfo lets
# us select whether to work with IPv4 DNS records, IPv6 records, or both.
I believe the reason for this has to do with using `http://hub:4444/wd/hub` as the URL.
In pipelines what should I be using for that URL? I've tried `localhost` and `127.0.0.1` with no luck.
I am using Docker to try to replicate the Pipelines environment locally so I don't burn through minutes if not necessary. But now that it works locally - I'm at a loss on how to get this going in Bitbucket Pipelines.
...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events