def test_get_docker_env_2(self, fake_check_output, fake_config_value): fake_config_value.return_value = 'root' fake_check_output.return_value = """Variables are already set""" expected = {'DOCKER_TLS_VERIFY': '1', 'DOCKER_HOST': 'tcp://192.168.59.103:2376', 'DOCKER_CERT_PATH': '/Users/root/.boot2docker/certs/boot2docker-vm'} result = get_docker_env() self.assertItemsEqual(result, expected)
def test_get_docker_env_2(self, fake_check_output, fake_config_value): fake_config_value.return_value = 'root' fake_check_output.return_value = """ export DOCKER_TLS_VERIFY=1 export DOCKER_HOST=tcp://192.168.59.103:2376 export DOCKER_CERT_PATH=/Users/root/.docker/machine/machines/dusty/cert.pem""" expected = {'DOCKER_TLS_VERIFY': '1', 'DOCKER_HOST': 'tcp://192.168.59.103:2376', 'DOCKER_CERT_PATH': '/Users/root/.docker/machine/machines/dusty/cert.pem'} result = get_docker_env() self.assertItemsEqual(result, expected)
def test_get_docker_env_2(self, fake_check_output, fake_config_value): fake_config_value.return_value = 'root' fake_check_output.return_value = """ export DOCKER_TLS_VERIFY=1 export DOCKER_HOST=tcp://192.168.59.103:2376 export DOCKER_CERT_PATH=/Users/root/.docker/machine/machines/dusty/cert.pem""" expected = { 'DOCKER_TLS_VERIFY': '1', 'DOCKER_HOST': 'tcp://192.168.59.103:2376', 'DOCKER_CERT_PATH': '/Users/root/.docker/machine/machines/dusty/cert.pem' } result = get_docker_env() self.assertItemsEqual(result, expected)
def exec_docker_patch(self, *args): docker_executable = subprocess.check_output('which docker', shell=True).rstrip('\n') args = [docker_executable] + [a for a in args] self.exec_docker_processes.append(subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=get_docker_env()))
def exec_docker_patch(self, *args): docker_executable = subprocess.check_output("which docker", shell=True).rstrip("\n") args = [docker_executable] + [a for a in args] self.exec_docker_processes.append( subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=get_docker_env()) )