From 72ef93b73c64c9729fc8966f31fc76ff822577df Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 25 Jan 2019 17:59:17 -0500 Subject: [PATCH] Add a podman client test --- test/clients/client.py | 30 ++++++++++++++++++++++++++++++ test/clients/clients_test.py | 8 +++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/test/clients/client.py b/test/clients/client.py index 27ddf9070..3b1698ac2 100644 --- a/test/clients/client.py +++ b/test/clients/client.py @@ -3,6 +3,8 @@ from collections import namedtuple from six import add_metaclass Command = namedtuple('Command', ['command']) + +# NOTE: FileCopy is done via `scp`, instead of `ssh` which is how Command is run. FileCopy = namedtuple('FileCopy', ['source', 'destination']) @@ -87,3 +89,31 @@ class DockerClient(Client): def verify(self, registry_host, namespace, name): yield Command('docker run %s/%s/%s echo testfile' % (registry_host, namespace, name)) + + +class PodmanClient(Client): + def setup_client(self, registry_host): + yield FileCopy('Dockerfile.test', '/home/vagrant/Dockerfile') + + def populate_test_image(self, registry_host, namespace, name): + yield Command('sudo podman build -t %s/%s/%s /home/vagrant/' % (registry_host, namespace, name)) + + def print_version(self): + yield Command('sudo podman version') + + def login(self, registry_host, username, password): + yield Command('sudo podman login --tls-verify=false --username=%s --password=%s %s' % + (username, password, registry_host)) + + def push(self, registry_host, namespace, name): + yield Command('sudo podman push --tls-verify=false %s/%s/%s' % (registry_host, namespace, name)) + + def pre_pull_cleanup(self, registry_host, namespace, name): + yield Command('sudo podman rmi -f %s/%s/%s' % (registry_host, namespace, name)) + yield Command('sudo podman rmi -f quay.io/quay/busybox') + + def pull(self, registry_host, namespace, name): + yield Command('sudo podman pull --tls-verify=false %s/%s/%s' % (registry_host, namespace, name)) + + def verify(self, registry_host, namespace, name): + yield Command('sudo podman run %s/%s/%s echo testfile' % (registry_host, namespace, name)) diff --git a/test/clients/clients_test.py b/test/clients/clients_test.py index 00805c58d..5fb98584e 100644 --- a/test/clients/clients_test.py +++ b/test/clients/clients_test.py @@ -9,7 +9,7 @@ from threading import Thread from termcolor import colored -from test.clients.client import DockerClient, Command, FileCopy +from test.clients.client import DockerClient, PodmanClient, Command, FileCopy def remove_control_characters(s): return "".join(ch for ch in unicode(s) if unicodedata.category(ch)[0]!="C") @@ -17,6 +17,8 @@ def remove_control_characters(s): # These tuples are the box&version and the client to use. BOXES = [ + ("kleesc/centos7-podman --box-version=0.11.1.1", PodmanClient()), # podman 0.11.1.1 + ("kleesc/coreos --box-version=1911.4.0", DockerClient()), # docker 18.06.1 ("kleesc/coreos --box-version=1800.7.0", DockerClient()), # docker 18.03.1 ("kleesc/coreos --box-version=1688.5.3", DockerClient()), # docker 17.12.1 @@ -168,8 +170,8 @@ def _run_box(box, client, registry): _run_commands(client.setup_client(registry)) print colored('>>> Client version', 'cyan') - docker_version = _run_commands(client.print_version()) - print _indent(docker_version, 4) + runtime_version = _run_commands(client.print_version()) + print _indent(runtime_version, 4) print colored('>>> Populating test image', 'yellow') _run_commands(client.populate_test_image(registry, namespace, repo_name))