|
1 | 1 | --- |
2 | 2 | name: local-platform-e2e |
3 | | -description: Stand up benchmarks-platform locally (Postgres + MinIO + ClickHouse in docker) and run a real @benchsdk/cli benchmark against it, with no cloud or provider credentials. Use when testing @benchsdk/client / @benchsdk/cli against the platform end to end, or when debugging benchmark reporting, worker planning, artifacts, or dashboard results locally. |
| 3 | +description: Stand up benchmarks-platform locally (Postgres + MinIO + ClickHouse in docker) and run a real @benchsdk/runner benchmark against it, with no cloud or provider credentials. Use when testing @benchsdk/client / @benchsdk/runner against the platform end to end, or when debugging benchmark reporting, worker planning, artifacts, or dashboard results locally. |
4 | 4 | --- |
5 | 5 |
|
6 | | -# Local end-to-end: @benchsdk/cli ↔ benchmarks-platform |
| 6 | +# Local end-to-end: @benchsdk/runner ↔ benchmarks-platform |
7 | 7 |
|
8 | 8 | Goal: exercise upsert benchmark → create run → planWorkers → claim → heartbeat → |
9 | 9 | task_results → artifact upload → complete → dashboard, with zero external |
@@ -130,29 +130,30 @@ Check `imported`/`failed`/`failureSamples` in the response. |
130 | 130 | Build first (`packages/*/dist` is not committed): `pnpm install && pnpm -r --filter "./packages/**" build`. |
131 | 131 |
|
132 | 132 | Write a throwaway bench inside the repo (untracked, e.g. `e2e-local/local.bench.ts`) |
133 | | -so pnpm workspace resolution finds `@benchsdk/cli`, with a fake participant: |
| 133 | +so pnpm workspace resolution finds `@benchsdk/runner`, with a fake participant: |
134 | 134 |
|
135 | 135 | ```ts |
136 | | -import { defineBenchmark, runBenchmark } from '@benchsdk/cli'; |
137 | | -const config = defineBenchmark({ |
| 136 | +import { defineBenchmarkConfig, defineTask } from '@benchsdk/runner'; |
| 137 | +export const config = defineBenchmarkConfig({ |
138 | 138 | benchmarkSlug: 'e2e-local', benchmarkName: 'E2E', iterations: 4, concurrency: 1, |
139 | | - task: async (ctx) => { await ctx.step('create', () => new Promise(r => setTimeout(r, 50))); }, |
| 139 | + participants: [{ name: 'local', requiredEnvVars: [] }], |
| 140 | +}); |
| 141 | +export const task = defineTask(async (ctx) => { |
| 142 | + await ctx.step('create', () => new Promise((r) => setTimeout(r, 50))); |
| 143 | + ctx.measure({ ok: true }); |
140 | 144 | }); |
141 | | -runBenchmark(config, [{ name: 'local', requiredEnvVars: [] } as any], process.argv.slice(2)); |
142 | 145 | ``` |
143 | 146 |
|
144 | | -Run it: |
| 147 | +Run it via the `bench run` CLI (under tsx so the `.bench.ts` module loads without a build): |
145 | 148 | ```bash |
146 | | -BENCHMARKS_PLATFORM_URL=http://localhost:3000 COMPUTESDK_ADMIN_API_KEY=local-admin-key \ |
147 | | - npx tsx e2e-local/local.bench.ts --iterations 4 --concurrency 2 |
| 149 | +BENCHMARKS_PLATFORM_URL=http://localhost:3000 BENCHMARKS_PLATFORM_API_KEY=<org bp_ key> \ |
| 150 | + npx tsx packages/benchsdk-runner/dist/bin.js run e2e-local/local.bench.ts --iterations 4 --concurrency 2 |
148 | 151 | ``` |
149 | 152 | `BENCHMARKS_PLATFORM_URL` is the **root** URL (the runner appends `/api/v1`). |
150 | 153 |
|
151 | | -The runner reads `COMPUTESDK_ADMIN_API_KEY ?? COMPUTESDK_API_KEY`, so to prove the master key |
152 | | -is not needed, pass an org `bp_` key as `COMPUTESDK_API_KEY` and strip the admin vars from the |
153 | | -child env (`env -u COMPUTESDK_ADMIN_API_KEY -u ADMIN_API_KEY …`). Note the "View at:" URL the |
154 | | -CLI prints uses `BENCHMARKS_PLATFORM_ORG_SLUG` (default `computesdk`), **not** the org that owns |
155 | | -the key, so with an org key the printed link may 404 — set that env var to the key's org slug. |
| 154 | +The runner authenticates with `BENCHMARKS_PLATFORM_API_KEY` (an org-scoped `bp_` key — mint one |
| 155 | +locally per the section below) and pulls the owning org slug from the server, so the "View at:" |
| 156 | +URL it prints always points at the run's real org (no `BENCHMARKS_PLATFORM_ORG_SLUG` needed). |
156 | 157 |
|
157 | 158 | ## 6b. Probing tenant isolation |
158 | 159 |
|
|
0 commit comments