Improve dashboard portability and installer smoke checks
This commit is contained in:
@@ -5,11 +5,13 @@ import path from 'node:path'
|
||||
const root = process.cwd()
|
||||
const createRoutePath = path.join(root, 'app/api/sandbox/create/route.ts')
|
||||
const deleteRoutePath = path.join(root, 'app/api/sandbox/delete/route.ts')
|
||||
const hostCommandsPath = path.join(root, 'app/lib/hostCommands.ts')
|
||||
const telemetryRoutePath = path.join(root, 'app/api/telemetry/real/route.ts')
|
||||
const inferenceRoutePath = path.join(root, 'app/api/inference/route.ts')
|
||||
const ollamaModelsRoutePath = path.join(root, 'app/api/ollama/models/route.ts')
|
||||
const sandboxInferenceRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/inference/route.ts')
|
||||
const sandboxInferenceApplyRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/inference/apply/route.ts')
|
||||
const sandboxInferenceApplyLibPath = path.join(root, 'app/lib/sandboxInferenceApply.ts')
|
||||
const sandboxRestartRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/restart/route.ts')
|
||||
const hookPath = path.join(root, 'app/hooks/useSandboxInventory.ts')
|
||||
const pagePath = path.join(root, 'app/page.tsx')
|
||||
@@ -21,11 +23,13 @@ const sandboxListPath = path.join(root, 'app/components/SandboxList.tsx')
|
||||
|
||||
const createRouteSource = await readFile(createRoutePath, 'utf8')
|
||||
const deleteRouteSource = await readFile(deleteRoutePath, 'utf8')
|
||||
const hostCommandsSource = await readFile(hostCommandsPath, 'utf8')
|
||||
const telemetryRouteSource = await readFile(telemetryRoutePath, 'utf8')
|
||||
const inferenceRouteSource = await readFile(inferenceRoutePath, 'utf8')
|
||||
const ollamaModelsRouteSource = await readFile(ollamaModelsRoutePath, 'utf8')
|
||||
const sandboxInferenceRouteSource = await readFile(sandboxInferenceRoutePath, 'utf8')
|
||||
const sandboxInferenceApplyRouteSource = await readFile(sandboxInferenceApplyRoutePath, 'utf8')
|
||||
const sandboxInferenceApplyLibSource = await readFile(sandboxInferenceApplyLibPath, 'utf8')
|
||||
const sandboxRestartRouteSource = await readFile(sandboxRestartRoutePath, 'utf8')
|
||||
const hookSource = await readFile(hookPath, 'utf8')
|
||||
const pageSource = await readFile(pagePath, 'utf8')
|
||||
@@ -50,7 +54,8 @@ assert.match(hookSource, /type RefreshOptions = \{\s*force\?: boolean\s*\}/, 'in
|
||||
assert.match(hookSource, /!refreshOptions\?\.force && inFlightRef\.current/, 'forced inventory refresh must bypass existing in-flight reads')
|
||||
assert.match(hookSource, /requestIdRef = useRef\(0\)/, 'inventory refresh must guard against stale concurrent responses')
|
||||
|
||||
assert.match(deleteRouteSource, /OPENSHELL_BIN.*openshell/, 'delete route must use the OpenShell CLI')
|
||||
assert.match(deleteRouteSource, /OPENSHELL_BIN/, 'delete route must use the shared OpenShell CLI resolver')
|
||||
assert.match(hostCommandsSource, /export const OPENSHELL_BIN[\s\S]*"openshell"/, 'shared command resolver must fall back to the OpenShell CLI')
|
||||
assert.match(deleteRouteSource, /\["sandbox", "delete", sandboxName\]/, 'delete route must call openshell sandbox delete with the sandbox name')
|
||||
assert.match(deleteRouteSource, /validateSandboxName/, 'delete route must validate sandbox names before execution')
|
||||
assert.match(deleteRouteSource, /resolveSandboxRef/, 'delete route must resolve sandbox ids to names before deleting')
|
||||
@@ -81,15 +86,15 @@ assert.match(sandboxInferencePanelSource, /\/api\/sandbox\/\$\{encodeURIComponen
|
||||
assert.match(sandboxInferencePanelSource, /\/api\/ollama\/models/, 'selected sandbox UI must offer Ollama model selection')
|
||||
assert.match(sandboxInferencePanelSource, /Enabled Routes/, 'selected sandbox UI must show multiple enabled inference routes')
|
||||
assert.match(sandboxInferencePanelSource, /Add Route/, 'selected sandbox UI must allow adding provider/model routes')
|
||||
assert.match(sandboxInferenceApplyRouteSource, /\/sandbox\/\.openclaw\/openclaw\.json/, 'live apply must patch OpenClaw config inside the running sandbox')
|
||||
assert.match(sandboxInferenceApplyRouteSource, /sha256sum \/sandbox\/\.openclaw\/openclaw\.json > \/sandbox\/\.openclaw\/\.config-hash/, 'live apply must refresh the immutable OpenClaw config hash')
|
||||
assert.match(sandboxInferenceApplyRouteSource, /\["inference", "set", "--no-verify", "--provider", primary\.provider, "--model", primary\.model\]/, 'live apply must point OpenShell inference at the primary route')
|
||||
assert.match(sandboxInferenceApplyLibSource, /\/sandbox\/\.openclaw\/openclaw\.json/, 'live apply must patch OpenClaw config inside the running sandbox')
|
||||
assert.match(sandboxInferenceApplyLibSource, /sha256sum \/sandbox\/\.openclaw\/openclaw\.json > \/sandbox\/\.openclaw\/\.config-hash/, 'live apply must refresh the immutable OpenClaw config hash')
|
||||
assert.match(sandboxInferenceApplyLibSource, /\["inference", "set", "--no-verify", "--provider", primary\.provider, "--model", primary\.model\]/, 'live apply must point OpenShell inference at the primary route')
|
||||
assert.match(sandboxRestartRouteSource, /\["delete", "pod", sandboxName, "-n", OPENSHELL_SANDBOX_NAMESPACE, "--wait=false"\]/, 'restart route must restart the backing sandbox pod')
|
||||
assert.match(sandboxRestartRouteSource, /waitForSandboxReady\(sandboxName, 90000, 2000\)/, 'restart route must wait for OpenShell to report the sandbox ready')
|
||||
assert.match(sandboxListSource, /Restart Sandbox/, 'sandbox details must expose a restart sandbox button')
|
||||
assert.match(sandboxListSource, /\/api\/sandbox\/\$\{encodeURIComponent\(selectedSandbox\.id\)\}\/restart/, 'restart button must call the sandbox restart endpoint')
|
||||
assert.match(sandboxListSource, /<SandboxInferencePanel sandbox=\{selectedSandbox\} \/>/, 'sandbox list must render the per-sandbox inference profile panel for the selected sandbox')
|
||||
assert.match(sidebarSource, /Inference Endpoints/, 'sidebar settings item must be named Inference Endpoints')
|
||||
assert.match(sandboxListSource, /<SandboxInferencePanel sandbox=\{selectedSandbox\}/, 'sandbox list must render the per-sandbox inference profile panel for the selected sandbox')
|
||||
assert.match(sidebarSource, />Inference</, 'sidebar settings item must expose inference settings')
|
||||
assert.match(pageSource, /<InferenceEndpointPanel \/>/, 'settings view must render inference endpoint panel')
|
||||
|
||||
assert.match(pageSource, /fetch\('\/api\/sandbox\/delete'/, 'destroy workflow must call the real sandbox delete endpoint')
|
||||
|
||||
Reference in New Issue
Block a user