Refactor image_tests
This commit is contained in:
parent
6be47f2a85
commit
671c369838
@ -21,6 +21,8 @@ def pushtmpd():
|
||||
|
||||
|
||||
def test(method, image, branch, arch):
|
||||
result = True
|
||||
|
||||
if arch not in ['x86_64', 'i586']:
|
||||
return True
|
||||
|
||||
@ -37,6 +39,6 @@ def test(method, image, branch, arch):
|
||||
for command in commands:
|
||||
rc = subprocess.call(command, shell=True)
|
||||
if rc:
|
||||
return False
|
||||
result = False
|
||||
|
||||
return True
|
||||
return result
|
||||
|
@ -6,11 +6,6 @@ def test_docker(image: str) -> List[str]:
|
||||
ADD {image} /
|
||||
|
||||
RUN true > /etc/security/limits.d/50-defaults.conf
|
||||
RUN apt-get update && \
|
||||
apt-get install -y vim-console; \
|
||||
rm -f /var/cache/apt/archives/*.rpm \
|
||||
/var/cache/apt/*.bin \
|
||||
/var/lib/apt/lists/*.*
|
||||
|
||||
CMD ["/bin/bash"]"""
|
||||
|
||||
@ -20,7 +15,8 @@ CMD ["/bin/bash"]"""
|
||||
name = f'cloud_build_test_{abs(hash(image))}'
|
||||
commands = [
|
||||
f'docker build --rm --tag={name} .',
|
||||
f'docker run --rm {name}',
|
||||
f"docker run --rm {name} /bin/sh -c "
|
||||
"'apt-get update && apt-get install -y vim-console'",
|
||||
f'docker image rm {name}',
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user