# k8s-script **Repository Path**: vorne/k8s-script ## Basic Information - **Project Name**: k8s-script - **Description**: 用于k8s测试 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-09-27 - **Last Updated**: 2024-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # K8S测试脚本指南 ## 一. 仓库构成 仓库包含对于ARM和RISCV两个平台的测试脚本: ``` ├── ARM │   ├── disorder_test.go │   ├── env_set.sh │   ├── gen_perf_test.py │   ├── gen_test.py │   ├── parallel_perf_test.go │   ├── perf_count.py │   ├── performance_counter_920.sh │   ├── perf_test.sh │   ├── test_count.py │   ├── test_name_count.py │   └── test.sh └── RISCV ├── auto_test.sh └── env_set.sh ├── README.md ``` 因为对于两个平台的测试步骤除了环境搭建外基本一致,所以RISCV平台可以直接使用ARM平台的脚本进行测试。 ## 二. 脚本指南 ### 2.1 环境搭建 因为ARM与RISCV平台搭建流程有区别,因此分别写了环境搭建脚本env_set.sh。 当要在一个新的平台(ARM/RISCV)搭建K8S测试环境时,直接运行env_set.sh脚本: ``` chmod +x env_set.sh ./env_set.sh ``` ### 2.2 测试生成 此脚本ARM与RISCV平台通用。 运行gen_test.py脚本,注意根据本地情况修改脚本中文件输出路径以及文件名: ``` python3 gen_test.py ``` ### 2.3 测试运行 此脚本ARM与RISCV平台通用,即上一步生成的测试脚本。 运行test.sh脚本: ``` chmod +x test.sh //将测试结果保存到test.txt中 ./test.sh 2>&1 | tee test.txt ``` ### 2.4 测试统计 跑完的测试结果全部存于test.txt中,接下来就是对结果的统计,按照如下格式统计到excel表格中: | Test Name | Status | Run Details | | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | | TestTypes(test/e2e/framework/config) | Y | {=== RUN TestTypes --- PASS: TestTypes (0.00s) PASS} | | TestIngressToManifest | Y | {=== RUN TestIngressToManifest --- PASS: TestIngressToManifest (0.00s) PASS} | | TestNewFrameworkWithCustomTimeouts | Y | {=== RUN TestNewFrameworkWithCustomTimeouts --- PASS: TestNewFrameworkWithCustomTimeouts (0.00s) PASS} | | TestNewFramework(test/e2e/framework/internal/unittests) | Y | {=== RUN TestNewFramework --- PASS: TestNewFramework (0.00s) PASS} | | TestBugs | Y | {=== RUN TestBugs --- PASS: TestBugs (0.00s) PASS} | | TestListTests(test/e2e/framework/internal/unittests/list-labels) | Y | {=== RUN TestListTests --- PASS: TestListTests (0.00s) PASS} | | TestListTests(test/e2e/framework/internal/unittests/list-tests) | Y | {=== RUN TestListTests --- PASS: TestListTests (0.00s) PASS} | | TestPatches | Y | {=== RUN TestPatches --- PASS: TestPatches (0.00s) PASS} | | TestJSONPatchForUnstructured | Y | {=== RUN TestJSONPatchForUnstructured --- PASS: TestJSONPatchForUnstructured (0.00s) PASS} | 因为需要对不同测试文件下的相同测试名字进行分类,所以单独对test.txt中进行测试项名字的统计并保存到csv文件中(注意修改文件中文件路径与名称): ``` python3 test_name_count.py ``` 接下来继续对文件中测试细节进行统计并保存到csv文件中: ``` python3 test_count.py ``` 将文件合并即可得到最终结果。 ### 2.5 性能测试生成 对于之前生成的测试项统计test.txt文件进行性能测试。 运行gen_perf_test.py脚本,生成性能测试项: ``` python3 gen_perf_test.py ``` ### 2.6 性能测试运行 在这一步需要用到提供的性能测试脚本performance_counter_920.sh 在提供的脚本基础上,运行上一步生成的测试脚本,即仓库里的perf_test.sh ``` chmod +x performance_counter_920.sh chmod +x perf_test.sh ./perf_test.sh 2<&1 | tee perf_test.txt ``` ### 2.7 性能测试统计 跑完的性能测试结果全部存于perf_test.txt文件中,接下来需要对测试结果进行统计,按照如下格式统计到excel表格中: | Test Name | Performance Name | Performance Value | | ------------------------------------ | --------------------- | ----------------- | | TestTypes(test/e2e/framework/config) | duration time | 465454300 | | TestTypes(test/e2e/framework/config) | task clock | 1484.84 | | TestTypes(test/e2e/framework/config) | cpu-cycles | 2003281425 | | TestTypes(test/e2e/framework/config) | instructions | 2015837316 | | TestTypes(test/e2e/framework/config) | cache references | 769930599 | | TestTypes(test/e2e/framework/config) | cache misses | 8600147 | | TestTypes(test/e2e/framework/config) | branches | 408320826 | | TestTypes(test/e2e/framework/config) | branch misses | 10983613 | | TestTypes(test/e2e/framework/config) | L1 dcache loads | 769930599 | | TestTypes(test/e2e/framework/config) | L1 dcache load misses | 8600147 | | TestTypes(test/e2e/framework/config) | LLC load misses | 4021764 | | TestTypes(test/e2e/framework/config) | LLC load | 12193628 | | TestTypes(test/e2e/framework/config) | IPC | 1.006 | | TestIngressToManifest | duration time | 9531189610 | | TestIngressToManifest | task clock | 38207.77 | | TestIngressToManifest | cpu-cycles | 77487671197 | | TestIngressToManifest | instructions | 93852565838 | | TestIngressToManifest | cache references | 34788789104 | | TestIngressToManifest | cache misses | 352304558 | | TestIngressToManifest | branches | 20136825680 | | TestIngressToManifest | branch misses | 460884789 | | TestIngressToManifest | L1 dcache loads | 34788789104 | | TestIngressToManifest | L1 dcache load misses | 352304558 | | TestIngressToManifest | LLC load misses | 169290685 | | TestIngressToManifest | LLC load | 395672940 | | TestIngressToManifest | IPC | 1.211 | 因为测试项名称已经顺序与之前测试项完全一样,因此,直接可以运行测试内容统计脚本(注意修改测试文件名称与路径): ``` pyhton3 perf_count.py ``` ### 2.8 其他脚本说明 因为测试需要ARM与RISCV平台上测试项内容与顺序完全一致,因此写了如上脚本。如果只需要进行测试结果,对测试项顺序与内容无要求,可以按照如下步骤,运行其他GO脚本,另外,其中的并行脚本可以加快测试速度。 测试项: ``` go build disorder_test.go ./disorder_test test_list.json unit_test UTESTResult ./disorder_test test_list.json integration_test integrationTESTResult ./disorder_test test_list.json e2e_test e2eTESTResult ``` 统计脚本一致。 性能测试: ``` go build parallel_perf_test.go ./parallel_perf_test unit_test 2>&1 | tee unit_test.txt ./parallel_perf_test intergration_test 2>&1 | tee intergration_test.txt ./parallel_perf_test e2e_test 2>&1 | tee e2e_test.txt ``` 统计脚本一致。