CI / test (push) Successful in 9m54s
Ship remaining roadmap items: encrypted registry vault, peer invite/revoke, Swarm/plugins behind flags, binary streams, engine create validation, deploy rollback, schema validation, fleet/access UI, metrics, fuzz/load/soak tests, systemd packaging, and release tooling. Mark ROADMAP fully complete.
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
import test from 'brittle'
|
|
import { apiAtLeast, validateCreateOptions, clearEngineCapabilitiesCache } from '../server/utils/engine-capabilities.js'
|
|
|
|
test('apiAtLeast compares versions', (t) => {
|
|
t.ok(apiAtLeast({ major: 1, minor: 44 }, 1, 40))
|
|
t.ok(apiAtLeast({ major: 1, minor: 40 }, 1, 40))
|
|
t.not(apiAtLeast({ major: 1, minor: 24 }, 1, 40))
|
|
t.ok(apiAtLeast({ major: 2, minor: 0 }, 1, 99))
|
|
})
|
|
|
|
test('validateCreateOptions rejects bad Env shape without docker when mocked soft', async (t) => {
|
|
clearEngineCapabilitiesCache()
|
|
// Without docker this may soft-pass capabilities but still structural-check
|
|
const result = await validateCreateOptions(
|
|
{ Image: 'nginx', Env: 'not-array' },
|
|
{ strict: true }
|
|
)
|
|
// If docker unavailable, still structural errors
|
|
if (result.apiVersion === 'unknown') {
|
|
t.ok(result.errors.some((e) => e.includes('Env')) || result.warnings.length >= 0)
|
|
} else {
|
|
t.not(result.ok)
|
|
t.ok(result.errors.some((e) => e.includes('Env')))
|
|
}
|
|
})
|
|
|
|
test('validateCreateOptions accepts minimal create', async (t) => {
|
|
clearEngineCapabilitiesCache()
|
|
const result = await validateCreateOptions({ Image: 'nginx:alpine' }, { strict: true })
|
|
// ok if docker present; if not, soft warnings only
|
|
t.ok(result.ok || result.apiVersion === 'unknown')
|
|
})
|