Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kunlun test suite manual doc #15

Open
jd-zhang opened this issue May 10, 2022 · 23 comments
Open

kunlun test suite manual doc #15

jd-zhang opened this issue May 10, 2022 · 23 comments

Comments

@jd-zhang
Copy link
Contributor

Issue migrated from trac ticket # 659

component: DBA GUI | priority: major

2022-05-10 08:30:38: barney created the issue


  1. 新增测试命令
    1.1 --pg_connect(connection_name, hostname, user, password) -- pg连接
    hostname格式说明:
    computer.1 -- 连接元数据表中第一计算节点

1.2 --http_connect(connection_name, hostname, http_timeout) -- http连接用于执行http请求
hostname格式说明:
cluster_mgr -- 连接cluster_mgr主节点
node_mgr.1 --- 连接元数据表中第一个node_mgr
node_mgr.1.1 -- 连接shard 1下面第一个node_mgr
http_timeout --- 设置http请求超时时间,可以不填,默认为5s

1.3 --kl_rpc(hostname) -- rpc连接用于执行远程命令
hostname格式说明:
cluster_mgr -- 连接cluster主节点
cluster_mgr.1 -- 连接元数据表中第一个cluster_mgr节点
node_mgr.1 -- 连接元数据表中第一个node_mgr
node_mgr.1.1 -- 连接shard 1下面第一个node_mgr
shard.1 -- shard 1的存储主节点
storage.1 -- 元数据表中第一个存储节点
storage.1.1 -- shard 1的第一个存储节点
computer.1 -- 元数据表中第一个计算节点

1.4 --kl_cluster_id(number) -- 切换cluster_id
number 为cluster_id号, 如果有多个集群,编号1,2,3 。。。

1.5 --http --- http请求
格式如下:
--http
request_type: POST
header:Content-Type:application/json
body:{
"version" : "1.0",
"cluster_mgr_request_id" : "${tet}",
"job_type" : "node_debug",
"paras" :{
"op_type":"add",
"keyword":"mock_scan_mysqlerr_file"
},
"timestamp" : "1435749309",
"user_name" : "test"
}
EOF

1.6 http_reap --- 获取http执行命令结果
使用方法:
--let $job_id = http_reap(attachment.job_id)
该命令获取当前http请求返回json中attachment下job_id字段值
如果输入为空,则取出当前http返回的所有内容

1.7 kl_query_get_value -- kunlun-test支持mysql,pg执行sql获取数据
使用方法:
--let $left = kl_query_get_value(“select * from t1 limit 10”)
获取t1表中前10行数据

1.8 --kl_sql_compare($left, $right, key_col, num) --比较变量$left和$right存储的记录,key_col比较的主键名,可以为联合主键名,例如a;b;c ,num 比较行数,该变量可以不传。

1.9 --set_cluster_id(id) -- 手动设置集群id

  1. 原有命令基础上加入新特性
    2.1 -- connect(connection_name, hostname, user, password)
    hostname格式说明
    storage.1 -- 连接元数据表中第一个存储节点
    storage.1.1 -- 连接shard1的第一个存储节点
    shard.1 --连接shard 1的存储主节点
    shard_slave.2-1 --连接shard 2的第一个备存储节点
    test suite使用方法:
  2. 配置kunlun-test下的kunlun-cluster-test.conf文件
    配置[metadb]中元数据集群相关信息
    [metadb]
    hosts=127.0.0.1:7001;127.0.0.2:7001;127.0.0.3:7003
    user=pgx
    password=pgx_pwd

[cluster_work_mode] -- 增加work_mode配置,0.9.2之前版本,需要将value设置为1
value=0

[cluster_mgr]
cl_mgr=127.0.0.1:8110;127.0.0.2:8110;127.0.0.3:8110

[concurrent]
thread_num = 10

  1. 使用kunlun-cluster-test.py命令来跑测试文件
    python2 ./kunlun-cluster-test.py --config=./kunlun-test/kunlun-cluster-test.conf --test_file=xxx
    --test-file如果不输入,则默认跑kunlun-test/t下所有test文件, --test_file输入的是测试文件名,例如action_1st.test

  2. 测试文件,结果文件以及公共文体
    测试文件放到 kunlun-test/t
    结果文件放到 kunlun-test/r
    公共文件放到 kunlun-test/include

@jd-zhang
Copy link
Contributor Author

2022-05-10 08:32:29: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-10 08:40:51: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-10 08:44:06: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-10 09:04:19: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-11 14:53:48: barney uploaded file kunlun-cluster-test.py (4.2 KiB)

@jd-zhang
Copy link
Contributor Author

2022-05-11 14:54:01: barney uploaded file kunlun-test.tgz (1.7 KiB)

@jd-zhang
Copy link
Contributor Author

2022-05-12 14:58:24: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-12 16:48:42: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-12 16:56:53: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-12 17:12:35: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-14 10:22:37: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-17 09:30:50: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-17 09:55:00: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-17 13:37:41: barney edited the issue description

@jd-zhang
Copy link
Contributor Author

2022-05-17 16:43:25: hellen@zettadb.com commented


初次运行用例时,不用写result文件,
python2 ./kunlun-cluster-test.py --config=./kunlun-test/kunlun-cluster-test.conf --test_file=action_install_rbr.test --record
这样会自动创建对应的action_install_rbr.result文件。

@jd-zhang
Copy link
Contributor Author

2022-05-17 16:46:00: hellen@zettadb.com commented


1.目前includ文件中的
wait_http_request_finish.inc不生效,不需要使用。
2.研发提供的模板用例时:
action_1st.test
3.目前这套框架是基于clustermgr,所以需要通过clustermgr创建集群,然后进行其他测试。

@jd-zhang
Copy link
Contributor Author

2022-05-24 15:21:49: hellen@zettadb.com commented


远程执行命令:
--set_cluster_id(5)
--kl_cluster_id(1)
--exec ./kunlun-test/util/test_client node_mgr.2 "ls -l"

@jd-zhang
Copy link
Contributor Author

jd-zhang commented Jun 9, 2022

2022-06-09 17:37:46: hellen@zettadb.com

1 similar comment
@jd-zhang
Copy link
Contributor Author

jd-zhang commented Jun 9, 2022

2022-06-09 17:37:46: hellen@zettadb.com

@jd-zhang
Copy link
Contributor Author

jd-zhang commented Jun 9, 2022

2022-06-09 17:37:46: hellen@zettadb.com commented


新增:
shard_slave.1-1
表示第一个shard的第一个备
也就是:
shard_slave.1-2
表示第一个shard的第二个备
或shard_slave.n-1
表示第n个shard的第一个备
以此类推。

@jd-zhang
Copy link
Contributor Author

jd-zhang commented Jun 9, 2022

2022-06-09 18:10:48: barney set owner to barney

@jd-zhang
Copy link
Contributor Author

jd-zhang commented Jun 9, 2022

2022-06-09 18:10:48: barney changed status from new to assigned

@jd-zhang
Copy link
Contributor Author

jd-zhang commented Jun 9, 2022

2022-06-09 18:17:25: barney edited the issue description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant