Add additional versions of Docker against which we can test

This commit is contained in:
Joseph Schorr 2018-09-25 18:21:39 -04:00
parent ccb1670d78
commit e70abfa09e

View file

@ -12,17 +12,23 @@ def remove_control_characters(s):
return "".join(ch for ch in unicode(s) if unicodedata.category(ch)[0]!="C")
BOXES = [
("AntonioMeireles/coreos-stable --box-version=835.8.0", 'v1.8.3'),
("AntonioMeireles/coreos-stable --box-version=766.3.0", 'v1.7.1'),
("AntonioMeireles/coreos-stable --box-version=681.0.0", 'v1.6.2'),
("AntonioMeireles/coreos-stable --box-version=607.0.0", 'v1.5.0'),
("AntonioMeireles/coreos-stable --box-version=557.2.0", 'v1.4.1'),
("AntonioMeireles/coreos-stable --box-version=835.8.0", False),
("AntonioMeireles/coreos-stable --box-version=766.3.0", False),
("AntonioMeireles/coreos-stable --box-version=681.0.0", False),
("AntonioMeireles/coreos-stable --box-version=607.0.0", False),
("AntonioMeireles/coreos-stable --box-version=557.2.0", False),
("yungsang/coreos --box-version=1.3.8", 'v1.3.3'),
("yungsang/coreos --box-version=1.3.7", 'v1.3.2'),
("yungsang/coreos --box-version=1.2.9", 'v1.2.0'),
("yungsang/coreos --box-version=1.1.5", 'v1.1.2'),
("yungsang/coreos --box-version=1.0.0", 'v1.0.1'),
("yungsang/coreos --box-version=1.3.8", False),
("yungsang/coreos --box-version=1.3.7", False),
("yungsang/coreos --box-version=1.2.9", False),
("yungsang/coreos --box-version=1.1.5", False),
("yungsang/coreos --box-version=1.0.0", False),
("yungsang/coreos --box-version=1.0.0", False),
("yungsang/coreos --box-version=0.9.10", False),
("yungsang/coreos --box-version=0.9.6", False),
("yungsang/coreos --box-version=0.9.1", False),
("yungsang/coreos --box-version=0.3.1", True),
]
class CommandFailedException(Exception):
@ -96,10 +102,14 @@ def _run_and_wait(command, error_allowed=False):
print output
raise CommandFailedException()
return output
def _run_box(box, docker_version, registry):
print (colored('>>> Box: %s' % box, attrs=['bold']) + ' | ' +
colored('Docker version: %s' % docker_version, 'cyan', attrs=['bold']))
def _indent(text, amount):
return ''.join((' ' * amount) + line for line in text.splitlines(True))
def _run_box(box, requires_v1, registry):
print colored('>>> Box: %s' % box, attrs=['bold'])
print colored('>>> Starting box', 'yellow')
_run_and_wait(['vagrant', 'destroy', '-f'], error_allowed=True)
_run_and_wait(['rm', 'Vagrantfile'], error_allowed=True)
@ -111,12 +121,23 @@ def _run_box(box, docker_version, registry):
_run_and_wait(['vagrant', 'scp', '50-insecure-registry.conf', '/home/core'])
_run_and_wait(['vagrant', 'scp', 'Dockerfile.test', '/home/core/Dockerfile'])
cp_command = ('sudo cp /home/core/50-insecure-registry.conf ' +
cp_command = ('sudo cp /home/core/50-insecure-registry.conf ' +
'/etc/systemd/system/docker.service.d/50-insecure-registry.conf')
_run_and_wait(['vagrant', 'ssh', '-c', cp_command])
_run_and_wait(['vagrant', 'ssh', '-c', 'sudo systemctl daemon-reload'])
print colored('>>> Docker version', 'cyan')
docker_version = _run_and_wait(['vagrant', 'ssh', '-c', 'docker version'])
print _indent(docker_version, 4)
print colored('>>> Building test image', 'yellow')
if requires_v1:
# These versions of Docker don't support the new TLS cert on quay.io, so we need to pull
# from v1.quay.io and then retag so the build works.
_run_and_wait(['vagrant', 'ssh', '-c', 'docker pull v1.quay.io/quay/busybox'])
_run_and_wait(['vagrant', 'ssh', '-c',
'docker tag v1.quay.io/quay/busybox quay.io/quay/busybox'])
_run_and_wait(['vagrant', 'ssh', '-c', 'docker build -t %s/devtable/testrepo .' % registry])
print colored('>>> Testing login', 'cyan')
@ -127,8 +148,9 @@ def _run_box(box, docker_version, registry):
_run_and_wait(['vagrant', 'ssh', '-c', 'docker push %s/devtable/testrepo' % registry])
print colored('>>> Removing all images', 'yellow')
prefix = 'v1.' if requires_v1 else ''
_run_and_wait(['vagrant', 'ssh', '-c', 'docker rmi -f %s/devtable/testrepo' % registry])
_run_and_wait(['vagrant', 'ssh', '-c', 'docker rmi -f quay.io/quay/busybox'])
_run_and_wait(['vagrant', 'ssh', '-c', 'docker rmi -f %squay.io/quay/busybox' % prefix])
print colored('>>> Testing pull', 'cyan')
_run_and_wait(['vagrant', 'ssh', '-c', 'docker pull %s/devtable/testrepo' % registry])
@ -141,9 +163,9 @@ def _run_box(box, docker_version, registry):
def test_clients(registry='10.0.2.2:5000'):
print colored('>>> Running against registry ', attrs=['bold']) + colored(registry, 'cyan')
for box, docker_version in BOXES:
for box, requires_v1 in BOXES:
try:
_run_box(box, docker_version, registry)
_run_box(box, requires_v1, registry)
except CommandFailedException:
sys.exit(-1)