pear-run worker RPC timed out from the Electron UI. Run real holesail in Bare index.js (holesailBareControl) and have the UI call localhost HTTP instead of loading bare-tcp in the renderer.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import test from 'brittle'
|
||||
import { createRequire } from 'module'
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
const { start } = require('../client/holesailBareControl.cjs')
|
||||
|
||||
test('holesail Bare control HTTP health + auth', async (t) => {
|
||||
const statePath = path.join(os.tmpdir(), `pd-hs-${Date.now()}.json`)
|
||||
const ctl = await start({ statePath })
|
||||
t.ok(ctl.baseUrl)
|
||||
t.ok(fs.existsSync(statePath))
|
||||
|
||||
const health = await fetch(`${ctl.baseUrl}/health`)
|
||||
t.is(health.status, 200)
|
||||
const hj = await health.json()
|
||||
t.is(hj.service, 'holesail-local')
|
||||
|
||||
const unauth = await fetch(`${ctl.baseUrl}/list`)
|
||||
t.is(unauth.status, 401)
|
||||
|
||||
const list = await fetch(`${ctl.baseUrl}/list`, {
|
||||
headers: { 'X-Peardock-Token': ctl.token },
|
||||
})
|
||||
t.is(list.status, 200)
|
||||
const lj = await list.json()
|
||||
t.ok(lj.ok)
|
||||
t.alike(lj.result, [])
|
||||
|
||||
await ctl.close()
|
||||
t.absent(fs.existsSync(statePath))
|
||||
})
|
||||
Reference in New Issue
Block a user