summaryrefslogtreecommitdiff
path: root/0031-add-testcase-for-isula-info.patch
blob: d57e8cccf90986d7ee003caff52bf6b8ee3c5c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From e40f451f5b919ba4154cc6005439f6b4370a7ac3 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 4 Sep 2023 17:13:13 +0800
Subject: [PATCH 31/33] add testcase for isula info

Signed-off-by: haozi007 <liuhao27@huawei.com>
---
 CI/test_cases/container_cases/info.sh | 95 +++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100755 CI/test_cases/container_cases/info.sh

diff --git a/CI/test_cases/container_cases/info.sh b/CI/test_cases/container_cases/info.sh
new file mode 100755
index 00000000..e6c03a49
--- /dev/null
+++ b/CI/test_cases/container_cases/info.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+#
+# attributes: isula info operator
+# concurrent: YES
+# spend time: 1
+
+#######################################################################
+##- Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
+# - iSulad licensed under the Mulan PSL v2.
+# - You can use this software according to the terms and conditions of the Mulan PSL v2.
+# - You may obtain a copy of Mulan PSL v2 at:
+# -     http://license.coscl.org.cn/MulanPSL2
+# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+# - PURPOSE.
+# - See the Mulan PSL v2 for more details.
+##- @Description:CI
+##- @Author: haozi007
+##- @Create: 2023-09-04
+#######################################################################
+
+curr_path=$(dirname $(readlink -f "$0"))
+data_path=$(realpath $curr_path/../data)
+source ../helpers.sh
+
+function do_test_t()
+{
+    check_valgrind_log
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
+    export http_proxy="http://test:123456@testproxy.com"
+    export https_proxy="http://test:123456@testproxy.com"
+    export no_proxy="127.0.0.1"
+    start_isulad_with_valgrind
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++))
+    isula info | grep "Http Proxy" | grep "http://xxxx:xxxx@testproxy.com"
+    fn_check_eq "$?" "0" "check http proxy failed"
+    isula info | grep "Https Proxy" | grep "http://xxxx:xxxx@testproxy.com"
+    fn_check_eq "$?" "0" "check https proxy failed"
+    isula info | grep "No Proxy" | grep "127.0.0.1"
+    fn_check_eq "$?" "0" "check no proxy failed"
+
+    check_valgrind_log
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
+    export http_proxy="https://example.com"
+    export no_proxy="127.0.0.1"
+    start_isulad_with_valgrind
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++))
+    isula info | grep "Http Proxy" | grep "https://example.com"
+    fn_check_eq "$?" "0" "check http proxy failed"
+    isula info | grep "No Proxy" | grep "127.0.0.1"
+    fn_check_eq "$?" "0" "check no proxy failed"
+
+    check_valgrind_log
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
+    export http_proxy="http//abc.com"
+    export no_proxy="127.0.0.1:localhost"
+    start_isulad_with_valgrind
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++))
+    isula info | grep "Http Proxy"
+    fn_check_ne "$?" "0" "check http proxy failed"
+    isula info | grep "No Proxy"
+    fn_check_ne "$?" "0" "check no proxy failed"
+
+    check_valgrind_log
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
+    export http_proxy="http//xxxx@abc:abc.com"
+    export no_proxy="127.0.0.1"
+    start_isulad_with_valgrind
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++))
+    isula info | grep "Http Proxy"
+    fn_check_ne "$?" "0" "check http proxy failed"
+    isula info | grep "No Proxy"
+    fn_check_ne "$?" "0" "check no proxy failed"
+
+    check_valgrind_log
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
+    unset https_proxy http_proxy no_proxy
+    start_isulad_with_valgrind
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++))
+    isula info | grep "Http Proxy"
+    fn_check_ne "$?" "0" "check http proxy failed"
+    isula info | grep "No Proxy"
+    fn_check_ne "$?" "0" "check no proxy failed"
+
+    return $TC_RET_T
+}
+
+ret=0
+
+do_test_t
+if [ $? -ne 0 ];then
+    let "ret=$ret + 1"
+fi
+
+show_result $ret "basic info"
-- 
2.40.1