From 83dd3f790f4ab2a3e815f0af1ab6e1fdc80cf0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8E=E8=BD=B6?= <11728005+zhang-mingyi66@user.noreply.gitee.com> Date: Sat, 29 Oct 2022 13:03:02 +0000 Subject: [PATCH 1/3] add test/testcases/kmesh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张明轶 <11728005+zhang-mingyi66@user.noreply.gitee.com> --- test/testcases/kmesh/common.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/testcases/kmesh/common.sh diff --git a/test/testcases/kmesh/common.sh b/test/testcases/kmesh/common.sh new file mode 100644 index 0000000..e69de29 -- Gitee From 1c7649e7394f891fbda0ff91b5de8761b29944e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8E=E8=BD=B6?= <11728005+zhang-mingyi66@user.noreply.gitee.com> Date: Sat, 29 Oct 2022 13:19:43 +0000 Subject: [PATCH 2/3] update test/testcases/kmesh/common.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张明轶 <11728005+zhang-mingyi66@user.noreply.gitee.com> --- test/testcases/kmesh/common.sh | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/test/testcases/kmesh/common.sh b/test/testcases/kmesh/common.sh index e69de29..3ced160 100644 --- a/test/testcases/kmesh/common.sh +++ b/test/testcases/kmesh/common.sh @@ -0,0 +1,66 @@ +#!/usr/bin/bash +source ${OET_PATH}/libs/locallibs/common_lib.sh + +#start fortio server +#default localhost:8080 +#transferred follows ip:port +function start_fortio_server() +{ + if [ ! -n "$1" ];then + fortio server > tmp_fortio_server.log 2>&1 & + sleep 0.1 + grep 'http://localhost:8080/fortio/' tmp_fortio_server.log + else + local ip_port=$1 + fortio server -http-port "$ip_port" > tmp_fortio_server.log 2>&1 & + sleep 0.1 + grep "http://${ip_port}/fortio/" tmp_fortio_server.log + fi + CHECK_RESULT $? 0 0 "fortio server start failed" +} + +#start kmesh-daemon +function start_kmesh() +{ + kmesh-daemon -enable-kmesh=true -enable-ads=false -config-file $CURRENT_PATH/conf/test_conf.json > tmp_kmesh_daemon.log & + sleep 3 + grep "command StartServer successful" tmp_kmesh_daemon.log + CHECK_RESULT $? 0 0 "kmesh-daemon start failed" +} + +#load kmesh config and check +function load_kmesh_config() +{ + kmesh-cmd -config-file=$CURRENT_PATH/conf/test_conf.json > tmp_kmesh_cmd.log & + CHECK_RESULT $? 0 0 "kmesh-cmd start failed" + sleep 0.5 + curl http://127.0.0.1:15200/bpf/kmesh/maps --connect-timeout 5 > tmp_kmesh_conf_read.log + grep "stenerConfigs\|routeConfigs\|clusterConfigs" tmp_kmesh_conf_read.log + CHECK_RESULT $? 0 0 "check kmesh conf failed" +} + +#use bpftool trace test result +function curl_test( +{ + bpftool prog tracelog > tmp_bpftool_prog_trace.log & + curl -g http://127.0.0.1:9081/fortio/ --connect-timeout 5 > /dev/null + CHECK_RESULT $? 0 0 "curl fortio server failed" + pkill bpftool + grep "cluster=.*loadbalance to addr" tmp_bpftool_prog_trace.log + CHECK_RESULT $? 0 0 "check kmesh-daemon log failed" + #check fortio server log + grep "GET /fortio/" tmp_fortio_server.log + CHECK_RESULT $? 0 0 "check fortio server log failed" +} + +#environment cleanup +#end the fortio and kmesh-daemon process +#remove fortio +function cleanup() +{ + rm -rf tmp*.log + pkill fortio + pkill kmesh-daemon + rmmod kmesh + yum remove -y fortio +} \ No newline at end of file -- Gitee From c0ae9ca8cfdbcf51eef671f274678ea582d3a9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8E=E8=BD=B6?= <11728005+zhang-mingyi66@user.noreply.gitee.com> Date: Mon, 31 Oct 2022 03:00:43 +0000 Subject: [PATCH 3/3] update test/testcases/kmesh/common.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张明轶 <11728005+zhang-mingyi66@user.noreply.gitee.com> --- test/testcases/kmesh/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testcases/kmesh/common.sh b/test/testcases/kmesh/common.sh index 3ced160..bb22599 100644 --- a/test/testcases/kmesh/common.sh +++ b/test/testcases/kmesh/common.sh @@ -40,7 +40,7 @@ function load_kmesh_config() } #use bpftool trace test result -function curl_test( +function curl_test() { bpftool prog tracelog > tmp_bpftool_prog_trace.log & curl -g http://127.0.0.1:9081/fortio/ --connect-timeout 5 > /dev/null @@ -48,6 +48,7 @@ function curl_test( pkill bpftool grep "cluster=.*loadbalance to addr" tmp_bpftool_prog_trace.log CHECK_RESULT $? 0 0 "check kmesh-daemon log failed" + #check fortio server log grep "GET /fortio/" tmp_fortio_server.log CHECK_RESULT $? 0 0 "check fortio server log failed" -- Gitee