• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cameri / nostream / 27742605380

18 Jun 2026 07:02AM UTC coverage: 67.394% (+0.4%) from 66.995%
27742605380

Pull #641

github

web-flow
Merge f455b7a08 into faf55f1de
Pull Request #641: feat: add admin backend foundation (login, session, health)

1980 of 3297 branches covered (60.05%)

Branch coverage included in aggregate %.

185 of 221 new or added lines in 17 files covered. (83.71%)

4537 of 6373 relevant lines covered (71.19%)

19.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.24
/src/utils/admin-health.ts
1
import { getCacheClient } from '../cache/client'
2✔
2
import { getMasterDbClient } from '../database/client'
2✔
3

4
export interface AdminDependencyHealth {
5
  ok: boolean
6
}
7

8
export interface AdminHealthSnapshot {
9
  status: 'ok' | 'degraded'
10
  uptimeSeconds: number
11
  worker: {
12
    type: string
13
    index?: string
14
  }
15
  database: AdminDependencyHealth
16
  redis: AdminDependencyHealth
17
}
18

19
export const collectAdminHealthSnapshot = async (): Promise<AdminHealthSnapshot> => {
2✔
NEW
20
  const database = await pingDatabase()
×
NEW
21
  const redis = await pingRedis()
×
22

NEW
23
  return {
×
24
    status: database.ok && redis.ok ? 'ok' : 'degraded',
×
25
    uptimeSeconds: Math.floor(process.uptime()),
26
    worker: {
27
      type: process.env.WORKER_TYPE ?? 'primary',
×
28
      ...(process.env.WORKER_INDEX ? { index: process.env.WORKER_INDEX } : {}),
×
29
    },
30
    database,
31
    redis,
32
  }
33
}
34

35
const pingDatabase = async (): Promise<AdminDependencyHealth> => {
2✔
NEW
36
  try {
×
NEW
37
    await getMasterDbClient().raw('SELECT 1')
×
NEW
38
    return { ok: true }
×
39
  } catch {
NEW
40
    return { ok: false }
×
41
  }
42
}
43

44
const pingRedis = async (): Promise<AdminDependencyHealth> => {
2✔
NEW
45
  try {
×
NEW
46
    const client = getCacheClient()
×
NEW
47
    if (!client.isOpen) {
×
NEW
48
      await client.connect()
×
49
    }
NEW
50
    const pong = await client.ping()
×
NEW
51
    return { ok: pong === 'PONG' }
×
52
  } catch {
NEW
53
    return { ok: false }
×
54
  }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc