
kubeshop/testkube-curl-executor!Testkube Logo
Testkube Executor Curl 是 testkube 平台的测试执行器组件,基于 Curl 工具实现。其主要用途是执行 HTTP/HTTPS 请求测试,通过运行自定义 Curl 命令发起请求,并验证响应的状态码及响应体内容是否符合预期。
expected_status,以及响应体是否包含 expected_body 指定的内容。{{.param}})对输入进行参数化,实现测试用例的动态配置。--param 标志传递键值对参数,动态替换模板中的占位符。curl/test,与 Testkube 平台无缝集成。测试输入为 JSON 格式,包含以下字段:
| 字段 | 类型 | 说明 |
|---|---|---|
command | 字符串数组 | Curl 命令及参数,按执行顺序排列(如 ["curl", "[***]", "-H", "Accept: json"]) |
expected_status | 字符串 | 预期 HTTP 响应状态码(如 "200"、"404") |
expected_body | 字符串 | 预期响应体中需包含的内容(如 "{\"success\": true}") |
json{ "command": [ "curl", "[***]", "-H", "Accept: application/json" ], "expected_status": "200", "expected_body": "{\"success\":\"true\"}" }
通过模板语法 {{.param}} 定义占位符,实现参数动态替换:
json{ "command": [ "curl", "{{.url}}", "-H", "{{.header}}" ], "expected_status": "{{.status}}", "expected_body": "{{.body}}" }
使用 Testkube CLI 的 --param 标志传递参数,替换模板中的占位符。例如,针对上述模板示例,通过以下命令传递参数:
bashtestkube run test -f test-input.json --param url=[***] --param header="Accept: application/json" --param status=200 --param body="{\"success\":\"true\"}"
创建测试时,需指定 CRD 类型为 curl/test,确保 Testkube 调用本执行器。示例 Testkube 测试 CRD:
yamlapiVersion: tests.testkube.io/v3 kind: Test metadata: name: my-curl-test spec: type: curl/test content: type: string data: | { "command": ["curl", "[***]", "-H", "Accept: application/json"], "expected_status": "200", "expected_body": "{\"success\":\"true\"}" }
Testkube Executor Curl 实现了 Testkube 执行器 OpenAPI 规范(详见 executor 标签),支持与 Testkube 平台的 API 交互(如测试执行、结果上报等)。
Testkube Executor Curl 作为 Testkube 生态的一部分,需部署在 Testkube 集群中。部署方式如下:
Testkube 安装时默认包含常用执行器(包括 Curl 执行器),可通过官方 Helm Chart 部署 Testkube:
bashhelm repo add testkube [***] helm install testkube testkube/testkube -n testkube --create-namespace
部署后,通过 Testkube CLI 验证执行器是否可用:
bashtestkube get executors | grep curl/test
如遇功能问题或需求增强,可在 Testkube 主仓库 提交 issues 或参与 discussions。




manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务