harbor/tests/apitests/python/library/containerd.py
danfengliu ab3e24a2e3 Add proxy cache python test scipts and upgrade containerd
Containerd in e2e image was using native one in ubuntu, it should be updated to the latest release.
And add proxy cache py-tests including pull image/manifest list by docker and ctr CLI.

Signed-off-by: danfengliu <danfengl@vmware.com>
2020-10-28 02:13:40 +00:00

22 lines
698 B
Python

# -*- coding: utf-8 -*-
import base
import json
import docker_api
def ctr_images_pull(username, password, oci):
command = ["sudo", "ctr", "images", "pull","--snapshotter", "native", "-u", username+":"+password, oci]
print("Command: ", command)
ret = base.run_command(command)
print("Command return: ", ret)
def ctr_images_list(oci_ref = None):
command = ["sudo", "ctr", "images", "list", "--q"]
print("Command: ", command)
ret = base.run_command(command)
print("Command return: ", ret)
if oci_ref is not None and oci_ref not in ret.split("\n"):
raise Exception(r" Get OCI ref failed, expected ref is [{}], but return ref list is [{}]".format (ret))