mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(sandbox): route host-shell surfaces into microVM via shell wrapper
This commit is contained in:
1 parent
aa3fb48a62
commit
ae117d6a78
57 files changed
+711
-784
No files matched your search
@@ -49,16 +49,19 @@ describe('entrypoint library wiring', () => {
|
||||
expect(warnIndex).toBeLessThan(chownIndex)
|
||||
})
|
||||
|
||||
it('grants node access to /dev/kvm before dropping privileges', () => {
|
||||
it('grants node access to /dev/kvm before dropping privileges without aborting startup', () => {
|
||||
const entrypoint = read(entrypointPath)
|
||||
expect(entrypoint).toMatch(/^grant_kvm_access\(\) \{/m)
|
||||
const alignIndex = entrypoint.indexOf('if ! align_container_user node; then')
|
||||
const grantCallIndex = entrypoint.indexOf('if ! grant_kvm_access; then')
|
||||
const runuserIndex = entrypoint.indexOf('exec runuser -u node')
|
||||
expect(alignIndex, 'entrypoint must align the container user').toBeGreaterThan(-1)
|
||||
expect(grantCallIndex, 'entrypoint must call grant_kvm_access').toBeGreaterThan(-1)
|
||||
expect(grantCallIndex).toBeGreaterThan(alignIndex)
|
||||
expect(runuserIndex).toBeGreaterThan(grantCallIndex)
|
||||
expect(entrypoint.slice(grantCallIndex, grantCallIndex + 60)).toMatch(/exit 1/)
|
||||
const grantBlock = entrypoint.slice(grantCallIndex, grantCallIndex + 200)
|
||||
expect(grantBlock).toMatch(/WARNING: continuing without \/dev\/kvm access/)
|
||||
expect(grantBlock.slice(0, grantBlock.indexOf('fi'))).not.toMatch(/exit 1/)
|
||||
})
|
||||
|
||||
it('does not re-chown /app when ids change', () => {
|
||||
|
||||
@@ -177,6 +177,7 @@ const runOpenCodeSection = (snippet: string, env: Record<string, string> = {}) =
|
||||
PATH: `${stubDir}:${homeDir}/.opencode/bin:/usr/bin:/bin`,
|
||||
OCM_STUB_LOG: logPath,
|
||||
HOME: homeDir,
|
||||
OPENCODE_BUNDLED_VERSION: '1.18.16',
|
||||
...env,
|
||||
},
|
||||
})
|
||||
@@ -204,6 +205,16 @@ describe('install_opencode', () => {
|
||||
expect(urls).not.toContain('/releases/latest/download/')
|
||||
})
|
||||
|
||||
it('refuses to guess the pinned build when OPENCODE_BUNDLED_VERSION is unset', () => {
|
||||
stubInstallTools()
|
||||
const res = runOpenCodeSection(`${extractInstallOpencode()}\ninstall_opencode`, {
|
||||
OPENCODE_BUNDLED_VERSION: '',
|
||||
})
|
||||
expect(res.status).not.toBe(0)
|
||||
expect(res.stderr).toContain('OPENCODE_BUNDLED_VERSION is not set')
|
||||
expect(curlLog()).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('honors an OPENCODE_BUNDLED_VERSION override for the download URL', () => {
|
||||
stubInstallTools()
|
||||
const res = runOpenCodeSection(`${extractInstallOpencode()}\ninstall_opencode`, {
|
||||
|
||||
Reference in new issue
Block a user