mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-17 20:50:53 +02:00
tests/unit: Add test for buid git URL as context
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
parent
92f0a8583a
commit
815450aba9
@ -180,3 +180,42 @@ class TestContainerToBuildArgs(unittest.TestCase):
|
|||||||
for c in cleanup_callbacks:
|
for c in cleanup_callbacks:
|
||||||
c()
|
c()
|
||||||
self.assertFalse(os.path.exists(temp_dockerfile))
|
self.assertFalse(os.path.exists(temp_dockerfile))
|
||||||
|
|
||||||
|
def test_context_git_url(self):
|
||||||
|
c = create_compose_mock()
|
||||||
|
|
||||||
|
cnt = get_minimal_container()
|
||||||
|
cnt['build']['context'] = "https://github.com/test_repo.git"
|
||||||
|
args = get_minimal_args()
|
||||||
|
|
||||||
|
args = container_to_build_args(c, cnt, args, lambda path: False)
|
||||||
|
self.assertEqual(
|
||||||
|
args,
|
||||||
|
[
|
||||||
|
'-t',
|
||||||
|
'new-image',
|
||||||
|
'--no-cache',
|
||||||
|
'--pull-always',
|
||||||
|
'https://github.com/test_repo.git',
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_context_invalid_git_url_git_is_not_prefix(self):
|
||||||
|
c = create_compose_mock()
|
||||||
|
|
||||||
|
cnt = get_minimal_container()
|
||||||
|
cnt['build']['context'] = "not_prefix://github.com/test_repo"
|
||||||
|
args = get_minimal_args()
|
||||||
|
|
||||||
|
with self.assertRaises(OSError):
|
||||||
|
container_to_build_args(c, cnt, args, lambda path: False)
|
||||||
|
|
||||||
|
def test_context_invalid_git_url_git_is_not_suffix(self):
|
||||||
|
c = create_compose_mock()
|
||||||
|
|
||||||
|
cnt = get_minimal_container()
|
||||||
|
cnt['build']['context'] = "https://github.com/test_repo.git/not_suffix"
|
||||||
|
args = get_minimal_args()
|
||||||
|
|
||||||
|
with self.assertRaises(OSError):
|
||||||
|
container_to_build_args(c, cnt, args, lambda path: False)
|
||||||
|
Loading…
Reference in New Issue
Block a user