113 lines
3.2 KiB
Diff
113 lines
3.2 KiB
Diff
From c62b1266dfbc4c28b5fd4dafea8438523826549d Mon Sep 17 00:00:00 2001
|
|
From: haozi007 <liuhao27@huawei.com>
|
|
Date: Sat, 31 Oct 2020 15:48:09 +0800
|
|
Subject: [PATCH 16/28] CI for support variable extension cni args
|
|
|
|
Signed-off-by: haozi007 <liuhao27@huawei.com>
|
|
---
|
|
CI/test_cases/container_cases/cni_test.sh | 55 +++++++++++++++++++
|
|
.../container_cases/criconfigs/mock.json | 9 +++
|
|
.../criconfigs/sandbox-config.json | 5 ++
|
|
3 files changed, 69 insertions(+)
|
|
create mode 100644 CI/test_cases/container_cases/criconfigs/mock.json
|
|
|
|
diff --git a/CI/test_cases/container_cases/cni_test.sh b/CI/test_cases/container_cases/cni_test.sh
|
|
index 115e031..8173cb5 100644
|
|
--- a/CI/test_cases/container_cases/cni_test.sh
|
|
+++ b/CI/test_cases/container_cases/cni_test.sh
|
|
@@ -154,6 +154,61 @@ function new_cni_config()
|
|
do_test_help "10\.2\."
|
|
}
|
|
|
|
+function check_annotation()
|
|
+{
|
|
+ cp ${data_path}/mock.json /etc/cni/net.d/bridge.json
|
|
+ sync;sync;
|
|
+ tail $ISUALD_LOG
|
|
+ # wait cni updated
|
|
+ s=`date "+%s"`
|
|
+ for ((i=0;i<30;i++)); do
|
|
+ sleep 1
|
|
+ cur=`date "+%s"`
|
|
+ let "t=cur-s"
|
|
+ if [ $t -gt 6 ];then
|
|
+ break
|
|
+ fi
|
|
+ done
|
|
+ tail $ISUALD_LOG
|
|
+
|
|
+ sid=`crictl runp ${data_path}/sandbox-config.json`
|
|
+ if [ $? -ne 0 ]; then
|
|
+ msg_err "Failed to run sandbox"
|
|
+ TC_RET_T=$(($TC_RET_T+1))
|
|
+ fi
|
|
+
|
|
+ basepath=/tmp/cnilogs/
|
|
+ cat ${basepath}/${sid}.env | grep CNI_MUTLINET_EXTENSION
|
|
+ if [ $? -ne 0 ];then
|
|
+ msg_err "lost extension for mutl network args"
|
|
+ TC_RET_T=$(($TC_RET_T+1))
|
|
+ fi
|
|
+ cat ${basepath}/${sid}.env | grep "extension=first"
|
|
+ if [ $? -ne 0 ];then
|
|
+ msg_err "lost extension for first cni args"
|
|
+ TC_RET_T=$(($TC_RET_T+1))
|
|
+ fi
|
|
+ cat ${basepath}/${sid}.env | grep "extension=second"
|
|
+ if [ $? -ne 0 ];then
|
|
+ msg_err "lost extension for second cni args"
|
|
+ TC_RET_T=$(($TC_RET_T+1))
|
|
+ fi
|
|
+
|
|
+ crictl stopp $sid
|
|
+ if [ $? -ne 0 ];then
|
|
+ msg_err "stop sandbox failed"
|
|
+ TC_RET_T=$(($TC_RET_T+1))
|
|
+ fi
|
|
+
|
|
+ crictl rmp $sid
|
|
+ if [ $? -ne 0 ];then
|
|
+ msg_err "rm sandbox failed"
|
|
+ TC_RET_T=$(($TC_RET_T+1))
|
|
+ fi
|
|
+
|
|
+ return $TC_RET_T
|
|
+}
|
|
+
|
|
ret=0
|
|
|
|
do_pre
|
|
diff --git a/CI/test_cases/container_cases/criconfigs/mock.json b/CI/test_cases/container_cases/criconfigs/mock.json
|
|
new file mode 100644
|
|
index 0000000..85bb91e
|
|
--- /dev/null
|
|
+++ b/CI/test_cases/container_cases/criconfigs/mock.json
|
|
@@ -0,0 +1,9 @@
|
|
+{
|
|
+ "cniVersion": "0.3.1",
|
|
+ "name": "mock",
|
|
+ "type": "isulad-cni",
|
|
+ "ipam": {
|
|
+ "type": "isulad-cni",
|
|
+ "subnet": "10.3.0.0/16"
|
|
+ }
|
|
+}
|
|
diff --git a/CI/test_cases/container_cases/criconfigs/sandbox-config.json b/CI/test_cases/container_cases/criconfigs/sandbox-config.json
|
|
index c63dc0e..e9151e8 100644
|
|
--- a/CI/test_cases/container_cases/criconfigs/sandbox-config.json
|
|
+++ b/CI/test_cases/container_cases/criconfigs/sandbox-config.json
|
|
@@ -7,5 +7,10 @@
|
|
"uid": "hdishd83djaidwnduwk28bcsb"
|
|
},
|
|
"linux": {
|
|
+ },
|
|
+ "annotations": {
|
|
+ "extension.network.kubernetes.io/cni": "[multinetwork]",
|
|
+ "extension.network.kubernetes.io/cniargs/first": "extension=first",
|
|
+ "extension.network.kubernetes.io/cniargs/second": "extension=second"
|
|
}
|
|
}
|
|
--
|
|
2.20.1
|
|
|