Add support for build arguments
Allows 'build' configuration option to be specified as an object and adds support for build args. Signed-off-by: Garrett Heel <garrettheel@gmail.com>
This commit is contained in:
parent
77b4ebc31f
commit
9cfa71ceee
9 changed files with 297 additions and 49 deletions
|
|
@ -355,7 +355,7 @@ class ServiceTest(unittest.TestCase):
|
|||
self.assertEqual(parse_repository_tag("url:5000/repo@sha256:digest"), ("url:5000/repo", "sha256:digest", "@"))
|
||||
|
||||
def test_create_container_with_build(self):
|
||||
service = Service('foo', client=self.mock_client, build='.')
|
||||
service = Service('foo', client=self.mock_client, build={'context': '.'})
|
||||
self.mock_client.inspect_image.side_effect = [
|
||||
NoSuchImageError,
|
||||
{'Id': 'abc123'},
|
||||
|
|
@ -374,17 +374,18 @@ class ServiceTest(unittest.TestCase):
|
|||
forcerm=False,
|
||||
nocache=False,
|
||||
rm=True,
|
||||
buildargs=None,
|
||||
)
|
||||
|
||||
def test_create_container_no_build(self):
|
||||
service = Service('foo', client=self.mock_client, build='.')
|
||||
service = Service('foo', client=self.mock_client, build={'context': '.'})
|
||||
self.mock_client.inspect_image.return_value = {'Id': 'abc123'}
|
||||
|
||||
service.create_container(do_build=False)
|
||||
self.assertFalse(self.mock_client.build.called)
|
||||
|
||||
def test_create_container_no_build_but_needs_build(self):
|
||||
service = Service('foo', client=self.mock_client, build='.')
|
||||
service = Service('foo', client=self.mock_client, build={'context': '.'})
|
||||
self.mock_client.inspect_image.side_effect = NoSuchImageError
|
||||
with self.assertRaises(NeedsBuildError):
|
||||
service.create_container(do_build=False)
|
||||
|
|
@ -394,7 +395,7 @@ class ServiceTest(unittest.TestCase):
|
|||
b'{"stream": "Successfully built 12345"}',
|
||||
]
|
||||
|
||||
service = Service('foo', client=self.mock_client, build='.')
|
||||
service = Service('foo', client=self.mock_client, build={'context': '.'})
|
||||
service.build()
|
||||
|
||||
self.assertEqual(self.mock_client.build.call_count, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue