summaryrefslogtreecommitdiff
path: root/0022-add-update-restart-policy-test.patch
blob: 1f324ae0c5c455a6c8d10a433fafe469afb7e3bd (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
From 6815aec33caedaacba3b392ee5a2e5088fdf1faa Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 21 Nov 2023 10:24:26 +0800
Subject: [PATCH 22/64] add update restart policy test

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 CI/test_cases/container_cases/update.sh | 26 +++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/CI/test_cases/container_cases/update.sh b/CI/test_cases/container_cases/update.sh
index d379acc2..29543e7c 100755
--- a/CI/test_cases/container_cases/update.sh
+++ b/CI/test_cases/container_cases/update.sh
@@ -138,6 +138,27 @@ function do_test_t()
     return $TC_RET_T
 }
 
+function test_autoremove_restartpolicy()
+{
+    containername=test_update2
+    containerid=`isula run -itd --runtime $1 --rm --name $containername busybox`
+    fn_check_eq "$?" "0" "run failed"
+
+    isula update --restart always $containerid
+    fn_check_ne "$?" "0" "update should fail"
+
+    isula update --restart nooooooooooo $containerid
+    fn_check_ne "$?" "0" "update should fail"
+
+    isula update --restart no $containerid
+    fn_check_eq "$?" "0" "update restart policy no failed"
+
+    isula rm -f $containername
+    fn_check_eq "$?" "0" "rm failed"
+
+    return $TC_RET_T
+}
+
 function do_test_t1()
 {
     containername=test_update1
@@ -173,6 +194,11 @@ do
         let "ret=$ret + 1"
     fi
 
+    test_autoremove_restartpolicy $element
+    if [ $? -ne 0 ];then
+        let "ret=$ret + 1"
+    fi
+
     if [ -f "/sys/fs/cgroup/memory/memory.memsw.usage_in_bytes" ];then
         do_test_t1 $element
         if [ $? -ne 0 ];then
-- 
2.42.0