From ea08b3c9b7c2c8cd49e707ecf0418246fbe53206 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 6 Jun 2023 15:41:30 +0800
Subject: [PATCH 07/15] add invalid copy testcase

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

diff --git a/CI/test_cases/container_cases/cp.sh b/CI/test_cases/container_cases/cp.sh
index 35e9168c..668ce09b 100755
--- a/CI/test_cases/container_cases/cp.sh
+++ b/CI/test_cases/container_cases/cp.sh
@@ -320,6 +320,25 @@ test_cp_symlink_from_container()
     return ${ret}
 }
 
+test_cp_invalid()
+{
+    local ret=0
+
+    isula cp nonexists1:/111 nonexists2:/222 2>&1 | grep "copying between containers is not supported"
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check output" && ((ret++))
+    
+    isula cp nonexists1:/111 nonexists2:/222
+    [[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy from container to container return success" && ((ret++))
+
+    isula cp 111 222 2>&1 | grep "must specify at least one container source"
+    [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check output" && ((ret++))
+
+    isula cp 111 222 2>&1
+    [[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy from host to host return success" && ((ret++))
+
+    return ${ret}
+}
+
 function cp_test_t()
 {
     local ret=0
@@ -360,6 +379,7 @@ function cp_test_t()
     test_cp_dir_to_container $containername || ((ret++))
     test_cp_symlink_to_container $containername || ((ret++))
     test_cp_symlink_from_container $containername || ((ret++))
+    test_cp_invalid || ((ret++))
 
     isula rm -f $containername
     [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container: ${containername}" && ((ret++))
-- 
2.25.1

