# Coremarket: manual test checklist Work through these after each deployment. Tick each box when the result matches **Expect**. Some expected values depend on prices, which change when live prices refresh. Those say "about" or describe a pattern instead of an exact figure. Sizing figures use the default workload: 5 concurrent users, 10 named users, 25% headroom, 30% disk growth. ## 0. Setup ```bash cd ~/Projects/coremarket cp .env.example .env # set ADMIN_USERNAME and ADMIN_PASSWORD (10+ characters) docker compose up -d --build docker compose logs | grep -i admin ``` - [ ] **0.1** The logs show `created admin account ''` on the first start. - [ ] **0.2** Temporarily remove both `ADMIN_*` lines from `.env`, delete the volume (`docker compose down -v`), and start again. **Expect:** the container won't start, and `docker compose logs` shows "First run: no accounts exist. Set ADMIN_USERNAME and ADMIN_PASSWORD…". Put the lines back and start again. - [ ] **0.3** With accounts existing, change `ADMIN_PASSWORD` in `.env` and restart. **Expect:** the log says the variables are ignored, and the old password still works. --- ## Part A: Browser Open http://localhost:8999. ### A1. Sign-in - [ ] **A1.1** Opening `/` while signed out redirects to `/login`. - [ ] **A1.2** A wrong password shows "Invalid username or password". - [ ] **A1.3** Five wrong passwords in a row, then a sixth attempt. **Expect:** "too many failed sign-in attempts; try again in … s". - [ ] **A1.4** The correct password (after the lock expires, or from another browser) opens the app. The header shows ` ▾`, **Edit Contabo prices** and **Refresh live prices**. - [ ] **A1.5** Opening http://localhost:8999/docs while signed in shows the Swagger API docs. Signed out, it redirects to `/login`. ### A2. Software tiers and sizing - [ ] **A2.0** On first load the dropdown shows **Base**, and no latency focus cities are selected (the RTT columns show "-" until you pick cities). - [ ] **A2.1** The **Federated tier** dropdown lists: Custom selection, Base · 2 apps · $19/mo, Good · 11 apps · $70/mo, Better · 18 apps · $145/mo, Best · 22 apps · $290/mo. - [ ] **A2.2** "Always included" shows **Traefik, Authelia, PowerDNS**. - [ ] **A2.3** Pick each tier. **Expect** vCPU / RAM GB / Disk GB: Base **2 / 5 / 90**, Good **4 / 12 / 270**, Better **6 / 21 / 340**, Best **6 / 26 / 380**. - [ ] **A2.4** With Base selected, the Compare line reads "Federated Base hosted by Federated is $19/mo (30 GB storage, managed, backups included)". - [ ] **A2.5** Tick an extra app (e.g. Vaultwarden). **Expect:** the dropdown changes to "Custom selection", and the Compare line disappears. - [ ] **A2.6** **Clear** unticks every app. - [ ] **A2.7** Set Concurrent users to 50. **Expect:** vCPU and RAM go up, and results update. - [ ] **A2.8** Type 8 into the vCPU override box. **Expect:** every quoted plan has at least 8 vCPU. - [ ] **A2.9** With Good selected, an amber note warns that the email server needs outbound TCP 25. ### A3. Results and filters - [ ] **A3.1** **Prices by region** shows sections for North America, Europe, Asia, Australia, Africa and South America, each saying "from $X first month". - [ ] **A3.2** Click the **HIPAA** chip. **Expect:** only AWS, Azure, Google Cloud, Oracle and DigitalOcean remain. - [ ] **A3.3** Also tick "accept partial". **Expect:** Vultr, Akamai/Linode, Alibaba and OVHcloud reappear. - [ ] **A3.4** Tick "exclude clouds that hard-block SMTP port 25". **Expect:** Azure, Google Cloud, DigitalOcean and Alibaba disappear. Providers marked "on request" or "open" stay. - [ ] **A3.5** Click the **South America** chip only. Select Bogota and Lima as focus cities, and set Max RTT to 60. **Expect:** the remaining options have a worst RTT of 60 or less. Oracle Bogota should be among them. - [ ] **A3.6** Click a column header (e.g. **Total**) twice. **Expect:** the sort direction flips. - [ ] **A3.7** **All options** shows every region. **Latency matrix** shows coloured RTT cells for 40 cities. - [ ] **A3.8** **Export CSV** downloads `coremarket-YYYY-MM-DD.csv`. It has one row per option and columns `rtt_ms_` for all 40 cities. ### A4. VM detail window - [ ] **A4.1** Click a row. A detail window opens with **Close** at the top right *and* at the bottom. Both close it, and so does Esc. - [ ] **A4.2** For a Contabo row, the price line reads "… = $X/month + $2.32 one-time setup = $Y first month". - [ ] **A4.3** "Next-best plans in this region" lists up to 4 alternatives. - [ ] **A4.4** Open an **AWS** or **Hetzner** row and click **measure** next to a nearby city. **Expect:** a real RTT in ms with probe names. Example: Hetzner Ashburn → Washington DC is about 2 ms. - [ ] **A4.5** Open a DigitalOcean or Contabo row. **Expect:** "No public probe endpoint is configured…" and no measure buttons. ### A5. Contabo price editor (admin) - [ ] **A5.1** **Edit Contabo prices** shows plans V153–V158 (Cloud VPS 4 to 18) in EUR, setup fee 2, and region surcharges (us-east 0). - [ ] **A5.2** Open **Paste a table** and paste: ``` | Code | Name | vCPU | RAM | Storage | Speed | Price/mo | |------|------|------|-----|---------|-------|----------| | V153 | Cloud VPS 4 | 4 | 8 GB | 100 GB SSD | 200 Mbit/s | €5.50 | | V154 | Cloud VPS 6 | 6 | 12 GB | 200 GB SSD | 300 Mbit/s | €7.50 | ``` Click **Load pasted table**. **Expect:** "Loaded 2 plans (EUR)", and the plan table shows 2 rows. - [ ] **A5.3** Set us-west's surcharge to 12 and click **Save prices**. **Expect:** the editor closes. Contabo rows show "manual sheet " as the price source, and Seattle is 12% above New York. - [ ] **A5.4** Restart the container (`docker compose restart`). **Expect:** the edits are still there. - [ ] **A5.5** **Reset to built-in** and confirm. **Expect:** all 6 plans return, and the source says "(defaults)". ### A6. Live prices (admin) - [ ] **A6.1** **Refresh live prices**. **Expect:** after about 30–60 s, a summary shows `vultr: ok`, `linode: ok`, `azure: ok`, with DigitalOcean/Hetzner "skipped (no API token configured)". The header then shows "Live prices: Microsoft, Vultr, Akamai". ### A7. Accounts (admin) - [ ] **A7.1** **Account ▾ → Users**. Create `alice` / `alice-password-1` / role `user`. **Expect:** "Created account "alice"." and a new row. - [ ] **A7.2** Try creating `alice` again. **Expect:** "username 'alice' already exists". - [ ] **A7.3** Try a password of `short`. **Expect:** an error about at least 10 characters. - [ ] **A7.4** On your own row there are no Disable/Delete buttons, and your role can't be changed. - [ ] **A7.5** **Reset password** for alice and enter `alice-password-2`. **Expect:** "Password for alice reset." ### A8. API keys - [ ] **A8.1** **Account ▾ → API keys**. Create a key named "test", choosing alice in **For account**. **Expect:** an amber box shows the full key (`cmk_…`) once, with a **Copy** button. Copy it for Part B. - [ ] **A8.2** Tick "show every account's keys". **Expect:** the new key is still displayed, and the table shows its account (alice). - [ ] **A8.3** Close and reopen the dialog. **Expect:** the full key is no longer shown, only `cmk_xxxxxxxx_…`. ### A9. Regular user Use a private window, or sign out first. - [ ] **A9.1** Sign in as `alice` / `alice-password-2`. **Expect:** no **Edit Contabo prices** or **Refresh live prices** buttons, and no **Users** item in the account menu. - [ ] **A9.2** The **Notes & API docs** tab has no "Edit prices" button. - [ ] **A9.3** Quotes, tiers, filters, CSV export and measure all work. - [ ] **A9.4** **API keys** lists only alice's keys, with no "show every account's keys" option. Create one, then **Revoke** it. - [ ] **A9.5** **Change password** with a wrong current password. **Expect:** "current password is incorrect". Then use the right one. **Expect:** "Password changed." - [ ] **A9.6** As admin, **Disable** alice. In alice's window, reload. **Expect:** back to the sign-in page, and alice can't sign in. Re-enable her afterwards. - [ ] **A9.7** **Sign out** returns to `/login`. Opening http://localhost:8999/ again redirects to `/login`. --- ## Part B: API (curl) ```bash export BASE=http://localhost:8999/api/v1 export KEY=cmk_... # alice's key from A8.1 (role: user) export ADMIN_KEY=cmk_... # create one for yourself under Account → API keys code() { curl -s -o /dev/null -w "%{http_code}\n" "$@"; } ``` ### B1. Authentication - [ ] **B1.1** `code $BASE/tiers` → **401** (no key). - [ ] **B1.2** `code -H "X-API-Key: $KEY" $BASE/tiers` → **200**. - [ ] **B1.3** `code -H "Authorization: Bearer $KEY" $BASE/tiers` → **200**. - [ ] **B1.4** `code -H "X-API-Key: cmk_deadbeef_nope" $BASE/tiers` → **401**. - [ ] **B1.5** `curl -s -H "X-API-Key: $KEY" $BASE/auth/me` → `"username": "alice", "role": "user", "auth": "api_key"`. - [ ] **B1.6** `code http://localhost:8999/healthz` → **200** without a key. - [ ] **B1.7** `code http://localhost:8999/openapi.json` → **401**. With `-H "X-API-Key: $KEY"` → **200**. ### B2. Reference data - [ ] **B2.1** `curl -s -H "X-API-Key: $KEY" $BASE/tiers` → 4 tiers. Base has `federated_price_usd_mo: 19` and `federated_storage_gb: 30`. - [ ] **B2.2** `curl -s -H "X-API-Key: $KEY" "$BASE/apps?tier=core"` → traefik, authelia, powerdns. - [ ] **B2.3** `curl -s -H "X-API-Key: $KEY" $BASE/providers | grep -o '"id":"[a-z]*"'` → 14 providers. - [ ] **B2.4** `curl -s -H "X-API-Key: $KEY" "$BASE/regions?continent=south-america&provider=oci"` → Oracle regions incl. `sa-bogota-1`. - [ ] **B2.5** `code -H "X-API-Key: $KEY" $BASE/apps/nope` → **404**. ### B3. Sizing and quotes - [ ] **B3.1** Size Base plus Vaultwarden for 20 users: ```bash curl -s -H "X-API-Key: $KEY" -X POST $BASE/size -H 'Content-Type: application/json' \ -d '{"tier":"base","apps":["vaultwarden"],"concurrent":20}' ``` **Expect:** `"need": {"vcpu": 3, "ram_gb": 7, "disk_gb": 90, …}`. - [ ] **B3.2** Quote with filters: ```bash curl -s -H "X-API-Key: $KEY" "$BASE/quote?tier=good&continent=europe&compliance=gdpr&cities=par,ber&best_per_provider=true&limit=5" ``` **Expect:** `returned: 5`, one result per provider, each with `rtt_avg_ms` / `rtt_max_ms`, and all with `compliance.gdpr` = `yes`. - [ ] **B3.3** `…/quote?tier=best&compliance=hipaa&cities=bog,lim&sort=rtt_max_ms&limit=3` → Oracle Bogota first. - [ ] **B3.4** `…/quote?apps=nextcloud&vcpu=8&ram_gb=32&limit=1` → `need.vcpu` 8, `need.ram_gb` 32. - [ ] **B3.5** `curl -s -H "X-API-Key: $KEY" -o q.csv "$BASE/quote?tier=better&format=csv"` → a CSV with a header row and one row per region (about 250). - [ ] **B3.6** Invalid input returns **422** with a helpful message: `tier=gold`, `apps=foo`, `continent=mars`, `compliance=iso`, `provider=ibm`, `cities=xyz`. ### B4. Roles - [ ] **B4.1** `code -H "X-API-Key: $KEY" $BASE/users` → **403** (user key). - [ ] **B4.2** `code -H "X-API-Key: $KEY" -X POST $BASE/prices/refresh` → **403**. - [ ] **B4.3** `code -H "X-API-Key: $KEY" -X DELETE $BASE/providers/contabo/price-sheet` → **403**. - [ ] **B4.4** `code -H "X-API-Key: $ADMIN_KEY" $BASE/users` → **200**. - [ ] **B4.5** A user can't create a key for someone else: `code -H "X-API-Key: $KEY" -X POST $BASE/keys -H 'Content-Type: application/json' -d '{"name":"x","user_id":1}'` → **403**. ### B5. Account management with the admin key - [ ] **B5.1** Create bob: `curl -s -H "X-API-Key: $ADMIN_KEY" -X POST $BASE/users -H 'Content-Type: application/json' -d '{"username":"bob","password":"bob-password-1"}'` → **201** with bob's `id`. - [ ] **B5.2** Create a 1-day key for bob (`"user_id": , "expires_days": 1`). **Expect:** the key is in the response once, with `expires_at` about 24 h from now. - [ ] **B5.3** Disable bob (`PATCH /users/` with `{"disabled": true}`). Bob's key → **401**. Re-enable → **200** again. - [ ] **B5.4** Delete bob. Bob's key → **401**. - [ ] **B5.5** Last-admin safeguard: with only one admin, `PATCH /users/` with `{"role":"user"}` → **409**. ### B6. Browser-session protection (CSRF) - [ ] **B6.1** Sign in with curl and try a write without the `X-Coremarket` header: ```bash curl -s -c jar -X POST $BASE/auth/login -H 'Content-Type: application/json' \ -d '{"username":"alice","password":"alice-password-2"}' code -b jar -X POST $BASE/size -H 'Content-Type: application/json' -d '{"tier":"base"}' ``` **Expect:** **403** "missing x-coremarket header…". Add `-H 'X-Coremarket: 1'` → **200**. ### B7. Latency measurement - [ ] **B7.1** ```bash curl -s -H "X-API-Key: $KEY" -X POST $BASE/latency/measure -H 'Content-Type: application/json' \ -d '{"host":"ash-speed.hetzner.com","city":"was"}' ``` **Expect:** `probe_scope: "city"`, `min_ms` about 1–5, and probes in Washington. - [ ] **B7.2** An unknown host (`"host":"example.com"`) → **422**. ### B8. Price sheet (admin key) - [ ] **B8.1** `GET $BASE/providers/contabo/price-sheet` → `is_default: true` (after a reset). - [ ] **B8.2** Use the README's `PUT` example with 2 plans. Then `…/quote?provider=contabo&tier=base&limit=1` returns a plan from those 2. - [ ] **B8.3** `DELETE` the sheet. `is_default` is `true` again. --- ## Part C: Persistence and restart - [ ] **C1** `docker compose restart`. Accounts, API keys and Contabo edits remain. Browser sessions survive, because they're stored in the database. - [ ] **C2** `docker compose down && docker compose up -d` (without `-v`). The same applies. - [ ] **C3** The cached live prices are still used after a restart. The header shows "Live prices: …" without needing to refresh. ## Report problems Note the test number, what you did, what you expected and what you saw. Include `docker compose logs --tail 50` if the server returned an error (5xx).