iSulad/0084-add-testcase-for-pulling-image.patch
WangFengTu b1ffa045c4 iSulad: sync with upstream iSulad
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
2021-05-18 14:48:15 +08:00

56 lines
2.4 KiB
Diff

From 1fb316f5e3ef84e57c40625d69a6aa900b978b83 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Thu, 22 Apr 2021 10:45:43 +0800
Subject: [PATCH 084/104] add testcase for pulling image
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
CI/test_cases/image_cases/registry.sh | 3 +++
test/image/oci/registry/data/v1/ping_head | 2 +-
test/image/oci/registry/registry_ut.cc | 4 ++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/CI/test_cases/image_cases/registry.sh b/CI/test_cases/image_cases/registry.sh
index c0a0db05..332af223 100755
--- a/CI/test_cases/image_cases/registry.sh
+++ b/CI/test_cases/image_cases/registry.sh
@@ -74,6 +74,9 @@ function isula_pull()
isula run --rm -ti busybox echo hello 2>&1 | grep pulling
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - --pull missing failed" && ((ret++))
+ isula pull hub.c.163.com/public/centos:6.7-tools
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - --pull hub.c.163.com/public/centos:6.7-tools failed" && ((ret++))
+
isula pull 3laho3y3.mirror.aliyuncs.com/library/busybox
fn_check_eq "$?" "0" "isula pull 3laho3y3.mirror.aliyuncs.com/library/busybox"
diff --git a/test/image/oci/registry/data/v1/ping_head b/test/image/oci/registry/data/v1/ping_head
index b0a076db..0d6a01c7 100644
--- a/test/image/oci/registry/data/v1/ping_head
+++ b/test/image/oci/registry/data/v1/ping_head
@@ -5,5 +5,5 @@ Content-Type: text/html; charset=utf-8
Content-Length: 4
Connection: close
Docker-Distribution-API-Version: registry/2.0
-WWW-Authenticate: Bearer realm="https://auth.quay.io",service="quay.io"
+WWW-Authenticate: Bearer realm="https://auth.quay.io",service="quay.io registry"
diff --git a/test/image/oci/registry/registry_ut.cc b/test/image/oci/registry/registry_ut.cc
index 182e28aa..fc944a5f 100644
--- a/test/image/oci/registry/registry_ut.cc
+++ b/test/image/oci/registry/registry_ut.cc
@@ -143,6 +143,10 @@ int invokeHttpRequestV1(const char *url, struct http_get_options *options, long
if (token_count == 2) {
file = data_path + "token_body2";
} else {
+ if (strstr(url, "quay.io registry") == NULL) {
+ ERROR("invalid url %s", url);
+ return -1;
+ }
file = data_path + "token_body";
}
} else if (util_has_prefix(url, "https://quay.io/v2/coreos/etcd/blobs/sha256")) {
--
2.25.1