e2e-test

A tool for creating and running end-to-end tests, which check a feature across the full system, for the Bifrost proxy.

In plain words
What is it for?
Use it to add or run Bifrost tests for proxy rules, request and response changes, TLS interception, forwarding, and related management-interface behavior.
Why use it?
It helps verify new features and bug fixes in realistic flows and keeps test files organized by purpose.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/bifrost-proxy/bifrost/e2e-test
Any agent
npx skills add bifrost-proxy/bifrost --skill e2e-test
Clone the repo
git clone --depth 1 https://github.com/bifrost-proxy/bifrost

Made for: Claude Code, Codex.

Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,722 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.01722
Opus 5 $0.00022 $0.00861
Sonnet 5 $0.00009 $0.00344
Haiku 4.5 $0.00004 $0.00172

Measured 3d ago against content hash cd7c6fa00020, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

e2e-test scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

trap 'rm -rf "$TEST_DIR"' EXIT

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- 管理端 API 是否 ready,例如 `curl -sS http://127.0.0.1:8800/_bifrost/api/proxy/address`
.agents/skills/e2e-test/SKILL.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

E2E 测试创建与执行

该技能用于创建和执行 Bifrost 的端到端测试,优先覆盖本次变更涉及的能力。

何时调用

  • 添加新功能后需要验证
  • 修复 bug 后需要回归测试
  • 需要创建新的测试用例
  • 需要运行现有的 E2E 测试

参考文档

在执行任务前,必须先阅读 E2E 测试框架的详细文档:

使用说明

  • 启动代理服务时,必须显式设置临时数据目录,避免覆盖本机已有数据;目录前缀统一使用 ./.bifrost-e2e
  • 若需要手动启动服务,优先使用“先编译、再启动”的方式,而不是直接假设 cargo run 或旧进程已生效
  • 新增或修改“规则行为”相关测试时,规则定义必须存放在 e2e-tests/rules/ 下,不能散落到根目录、临时文件或其他测试目录
  • e2e-tests/rules/ 下的规则文件必须按“模块功能 + 测试目标”组织:
    • 先按模块功能拆分子目录,例如 forwarding/request_modify/response_modify/
    • 再按单一测试目标拆分 .txt 文件;一个文件只表达一组紧密相关的规则语义,避免把多个无关目标塞进同一个文件
  • 规则文件命名要直接表达测试目标,使用小写下划线风格,例如 headers.txtwildcard_level.txttls_intercept_rule.txt
  • 每个规则文件顶部必须先写清楚测试目标,再写测试规则本体;顶部说明至少应回答“这个文件验证什么语义/行为”
  • 与规则文件配套的测试脚本必须存放在 e2e-tests/tests/,不能继续放在 scripts/、根目录或其他位置;脚本命名建议与测试目标对应,例如 test_header_replace.sh
  • 如果某个测试需要额外样例数据、模板或 mock 文件,分别放到现有的 e2e-tests/test_data/e2e-tests/mock_servers/ 等目录,不要和规则文件混放
  • 对涉及前端静态资源或管理端推送逻辑的改动,优先执行:
CARGO_TARGET_DIR=./.bifrost-ui-target cargo build --bin bifrost
BIFROST_DATA_DIR=./.bifrost-e2e-test ./.bifrost-ui-target/debug/bifrost start -p 8800 --unsafe-ssl
  • 启动后,必须同时检查:
    • 目标端口是否真的由最新 bifrost 进程监听,例如 lsof -nP -iTCP:8800 -sTCP:LISTEN
    • 管理端 API 是否 ready,例如 curl -sS http://127.0.0.1:8800/_bifrost/api/proxy/address
  • 如果启动过程中出现证书安装交互,先显式处理掉,再继续测试,避免把“服务未启动完成”误判为功能问题
  • 不同场景的步骤已拆分为独立文档;按需打开对应文件执行即可
  • 当 UI 现象和 API 现象不一致时,优先做“进程级 + API + WebSocket frame”三层交叉验证:
    • 先确认当前测试页面连到的是哪一个 bifrost 进程
    • 再确认 /_bifrost/api/traffic/_bifrost/api/traffic/{id} 返回的真实状态
    • 最后抓浏览器 /api/pushframesent/framereceived,判断是“服务端没推”还是“页面没订阅/没消费”
  • 新建规则测试后,顺手检查对应的规则文件与脚本是否一一对应;若无法建立清晰对应关系,应继续拆分目录或文件
  • 测试结束后清理临时目录和残留进程

CLI 测试方法

当本次变更涉及 bifrost CLI 子命令(例如 bifrost value ...bifrost rule ...bifrost script ...)时,推荐使用“黑盒 + 独立数据目录”的方式编写与执行测试:

  • 使用独立 BIFROST_DATA_DIR:用 mktemp -d 创建测试目录并导出,避免污染本机 ~/.bifrost
  • 优先复用已编译二进制:默认使用 target/release/bifrost,不存在时再 cargo build --release --bin bifrost
  • 断言策略:
    • 基于 CLI 输出:用 grep/jq(如有)做关键字段断言
    • 基于落盘结果:检查 BIFROST_DATA_DIR 下对应文件/目录是否按预期创建与更新
  • 清理策略:用 trap cleanup EXIT 确保结束后停止残留进程并删除临时目录

Read the full file on GitHub · 100 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 100 lines · 43 tokens per session scan C cd7c6fa00020

Subscribe to this mod's changes

e2e-test is a skill published in the GitHub repository bifrost-proxy/bifrost (124 stars, last pushed 4d ago), licensed MIT. It adds 43 tokens to every session and 1,722 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.