gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb554cd5fb554cd5flogmreb554cd5f/tests/reviews-seed.hl

1.6 KB

  1. // tests/reviews-seed.hl — the gate's seed (tests/reviews.mjs): a user, two repos (rv, other), a push token, and apps with live tokens in a TEST storage.
  2. // GITORIA_STORAGE=<abs table dir> GITORIA_GIT=<abs git root> bin/hybriel tests/reviews-seed.hl
  3. // prints: TOKEN <push token> / APP <name> <gat_ token> for Alpha and Beta (both on rv) and Gamma (on other), REPO <slug> <id>
  4. import { now } from 'hl:time'
  5. import { sha256 } from 'hl:crypto'
  6. import { ensureUser, setUserName } from '../lib/users.hl'
  7. import { createRepo, createRepoIn, createOrg, repoBySlug } from '../lib/repos.hl'
  8. import { createToken } from '../lib/tokens.hl'
  9. import { appsTable } from '../lib/apps-table.hl'
  10. import { issueToken } from '../lib/app-tokens.hl'
  11. u = ensureUser('gate-ident-w44')
  12. setUserName(u.id, 'Gate Owner')
  13. t = createToken(u.id, 'gate')
  14. console.log('TOKEN ' + t.token)
  15. r1 = createRepo(u.id, 'rv', '')
  16. r2 = createRepo(u.id, 'other', '')
  17. o = createOrg(u.id, 'acme', false)
  18. r3 = createRepoIn(u.id, 'acme', 'orgrepo', '', false)
  19. if (r1.error != null || r2.error != null || r3.error != null) { hlError('repo') }
  20. console.log('REPO rv ' + repoBySlug('rv').id)
  21. console.log('REPO other ' + repoBySlug('other').id)
  22. for (spec of [['rv', 'Alpha', repoBySlug('rv').id], ['rv', 'Beta', repoBySlug('rv').id], ['other', 'Gamma', repoBySlug('other').id], ['acme/orgrepo', 'Delta', repoBySlug('acme/orgrepo').id]]) {
  23. id = appsTable.put({ repo = spec[2] name = spec[1] hookUrl = 'https://x.worldapi.org/hook' keyHash = sha256('key-' + spec[1]) secret = 's' createdBy = u.id created = now() lastDelivery = 0 lastStatus = '' })
  24. a = appsTable.fetch(id)
  25. tk = issueToken(a)
  26. console.log('APP ' + spec[1] + ' ' + tk.token)
  27. }

Branches

Latest commits

  • b554cd5flogmre
  • f4c9440ddeploy.sh: tar --hard-dereference for the live data backupmre
  • 1a687b15Merge branch 'w48-member-merge'mre
  • 166c775fW48 report, logmre
  • 1b4623f0Members merge pull requests: API route, button on /pulls and /pulls/N, one shared merge pathmre
  • 1075c38cW48 mission, logmre
  • 17bdd0d6V37/V39 missions, logmre
  • 146de5f8Re-vendor gitoria to Hybriel set-day39 (51e921d7)mre
  • e874e44dtests/status-keyed: app token lives 60 s so it outlives the gate's two restartsmre
  • 270b8d61deploy.sh: DEPLOY_STOP_START=1 stops, waits for the old pid, then starts (mpackdb freeze, replaces the standby swap)mre
  • 3f9235b8project.hl: drop the dummy /pulls/:n component route (hybriel#294 is fixed in day37)mre
  • c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mre
  • 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
  • 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
  • 149dd512Rewrite W39 reportmre
  • e5385075Expect 401 for POST /api/repos without a tokenmre
  • 1a76055cDocument repository creation APImre
  • 4d779b3bAdd create-api gatemre
  • 88563122Add POST /api/repos for user tokensmre
  • b00860e3Create repositories with member checks in createRepoInmre