mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
Phase 6 of the relay split: the relay's deploy/operate surface moves under cloud/ with 24 cloud-* workflows gated on ORCA_CLOUD_OPERATIONS_ENABLED, the Cloud SQL rollout lease action, the relay Terraform root (dual-accept identities for both repositories), scripts, docs, CODEOWNERS, and a terraform validate job in Cloud Verify.
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
import { readProductionCapacityIdentity } from './read-relay-production-capacity-identity.mjs'
|
|
|
|
function revision(env) {
|
|
return { spec: { containers: [{ env }] } }
|
|
}
|
|
|
|
test('reads absent, exact, and foreign literal capacity identities', () => {
|
|
assert.equal(readProductionCapacityIdentity(revision([])), null)
|
|
assert.equal(
|
|
readProductionCapacityIdentity(revision([
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', value: 'capacity@example.test' }
|
|
])),
|
|
'capacity@example.test'
|
|
)
|
|
assert.equal(
|
|
readProductionCapacityIdentity(revision([
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', value: 'foreign@example.test' }
|
|
])),
|
|
'foreign@example.test'
|
|
)
|
|
})
|
|
|
|
test('rejects malformed or duplicate capacity identity entries', () => {
|
|
for (const entry of [
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', value: null },
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', value: '' },
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', valueSource: { secretKeyRef: {} } }
|
|
]) {
|
|
assert.throws(
|
|
() => readProductionCapacityIdentity(revision([entry])),
|
|
/not a literal string/
|
|
)
|
|
}
|
|
assert.throws(
|
|
() => readProductionCapacityIdentity(revision([
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', value: 'one@example.test' },
|
|
{ name: 'ORCA_RELAY_CAPACITY_SERVICE_ACCOUNT', value: 'two@example.test' }
|
|
])),
|
|
/duplicate capacity identity/
|
|
)
|
|
assert.throws(() => readProductionCapacityIdentity({}), /environment is missing/)
|
|
})
|