mirror of
https://github.com/docker/compose.git
synced 2025-07-20 12:14:41 +02:00
Fix some test failures.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
3a2735abb9
commit
59d1847d9b
@ -1151,6 +1151,8 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
|
|
||||||
@v3_only()
|
@v3_only()
|
||||||
def test_project_up_with_secrets(self):
|
def test_project_up_with_secrets(self):
|
||||||
|
create_host_file(self.client, os.path.abspath('tests/fixtures/secrets/default'))
|
||||||
|
|
||||||
config_data = build_config(
|
config_data = build_config(
|
||||||
version=V3_1,
|
version=V3_1,
|
||||||
services=[{
|
services=[{
|
||||||
@ -1181,7 +1183,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
container, = containers
|
container, = containers
|
||||||
|
|
||||||
output = container.logs()
|
output = container.logs()
|
||||||
assert output == "This is the secret\n"
|
assert output == b"This is the secret\n"
|
||||||
|
|
||||||
@v2_only()
|
@v2_only()
|
||||||
def test_initialize_volumes_invalid_volume_driver(self):
|
def test_initialize_volumes_invalid_volume_driver(self):
|
||||||
@ -1428,7 +1430,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config_data = build_config(config_dict)
|
config_data = load_config(config_dict)
|
||||||
project = Project.from_config(
|
project = Project.from_config(
|
||||||
name='composetest', config_data=config_data, client=self.client
|
name='composetest', config_data=config_data, client=self.client
|
||||||
)
|
)
|
||||||
@ -1465,7 +1467,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config_data = build_config(config_dict)
|
config_data = load_config(config_dict)
|
||||||
project = Project.from_config(
|
project = Project.from_config(
|
||||||
name='composetest', config_data=config_data, client=self.client
|
name='composetest', config_data=config_data, client=self.client
|
||||||
)
|
)
|
||||||
@ -1501,7 +1503,7 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config_data = build_config(config_dict)
|
config_data = load_config(config_dict)
|
||||||
project = Project.from_config(
|
project = Project.from_config(
|
||||||
name='composetest', config_data=config_data, client=self.client
|
name='composetest', config_data=config_data, client=self.client
|
||||||
)
|
)
|
||||||
@ -1515,3 +1517,30 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
assert 'svc1' in svc2.get_dependency_names()
|
assert 'svc1' in svc2.get_dependency_names()
|
||||||
with pytest.raises(NoHealthCheckConfigured):
|
with pytest.raises(NoHealthCheckConfigured):
|
||||||
svc1.is_healthy()
|
svc1.is_healthy()
|
||||||
|
|
||||||
|
|
||||||
|
def create_host_file(client, filename):
|
||||||
|
dirname = os.path.dirname(filename)
|
||||||
|
|
||||||
|
with open(filename, 'r') as fh:
|
||||||
|
content = fh.read()
|
||||||
|
|
||||||
|
container = client.create_container(
|
||||||
|
'busybox:latest',
|
||||||
|
['sh', '-c', 'echo -n "{}" > {}'.format(content, filename)],
|
||||||
|
volumes={dirname: {}},
|
||||||
|
host_config=client.create_host_config(
|
||||||
|
binds={dirname: {'bind': dirname, 'ro': False}},
|
||||||
|
network_mode='none',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
client.start(container)
|
||||||
|
exitcode = client.wait(container)
|
||||||
|
|
||||||
|
if exitcode != 0:
|
||||||
|
output = client.logs(container)
|
||||||
|
raise Exception(
|
||||||
|
"Container exited with code {}:\n{}".format(exitcode, output))
|
||||||
|
finally:
|
||||||
|
client.remove_container(container, force=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user