'``DockerClient.add`` accepts a ports argument which is passed to
Docker to expose those ports on the unit.
Assert that the busybox-http-app returns the expected "Hello world!"
response.
XXX: We should use a stable internal container instead. See
https://clusterhq.atlassian.net/browse/FLOC-120
XXX: The busybox-http-app returns headers in the body of its response,
hence this over complicated custom assertion. See
https://github.com/openshift/geard/issues/213'

def test_add_with_port(self):

    expected_response = 'Hello    world!\n'
    external_port = find_free_port()[1]
    name = random_name(self)
    d = self.start_container(name, ports=[PortMap(internal_port=8080, external_port=external_port)], retry_on_port_collision=True)
    d.addCallback((lambda ignored: self.request_until_response(external_port)))
    def started(response):
        d = content(response)
        d.addCallback((lambda body: self.assertIn(expected_response, body)))
        return d
    d.addCallback(started)
    return d
