Add test for cache_from

Signed-off-by: Joey Payne <jyapayne@gmail.com>
This commit is contained in:
Joey Payne 2017-02-20 13:20:13 -07:00
parent 5b6191e653
commit 33fcfca040
1 changed files with 15 additions and 0 deletions

View File

@ -32,6 +32,7 @@ from compose.service import NetworkMode
from compose.service import Service
from tests.integration.testcases import v2_1_only
from tests.integration.testcases import v2_only
from tests.integration.testcases import v3_only
def create_and_start_container(service, **override_options):
@ -946,6 +947,20 @@ class ServiceTest(DockerClientTestCase):
}.items():
self.assertEqual(env[k], v)
@v3_only()
def test_build_with_cachefrom(self):
base_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, base_dir)
with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
f.write("FROM busybox\n")
service = self.create_service('cache_from',
build={'context': base_dir,
'cache_from': ['build1']})
service.build()
assert service.image()
@mock.patch.dict(os.environ)
def test_resolve_env(self):
os.environ['FILE_DEF'] = 'E1'