Files
orca/cloud/dev/scripts/relay-load-region-behavior.mjs
Jinwoo-H 25e31c931d chore(cloud): add the relay fence broker, ops console, Terraform root, and scripts
Copies the private repository's relay side: the IAM-only fence broker, the
operations console and incident monitor, the relay Terraform root with its
backend configuration and tfvars, and the deploy/capacity/admission/rehome/
monitoring scripts the workflows call, with their contract tests, contracts,
and fixtures.

The foundation and apps Terraform roots and the API and auth services stay
private. Four surfaces that spanned both trees are narrowed to the relay side
rather than left with a dangling read: the infra runner and the root-partition
and workload-identity-condition renderers now declare only the relay root, and
the Cloud SQL rollout census drops the six app workflows that are not here.
2026-09-03 06:20:32 -04:00

36 lines
1.1 KiB
JavaScript

const ASSIGNMENT_RETRY_DELAY_MS = 5_100
const waitPastAssignmentRateLimit = (schedule) =>
new Promise((resolve) => schedule(resolve, ASSIGNMENT_RETRY_DELAY_MS))
export async function proveRelayLoadRegionBehavior({
oldClientPeer,
stickyPeer,
asiaOrigin,
scheduleAssignmentRetry = setTimeout
}) {
try {
await oldClientPeer.connect()
if (!oldClientPeer.assignedCellUrl() || oldClientPeer.assignedCellUrl() === asiaOrigin) {
throw new Error('unhinted client did not use the US-first path')
}
} finally {
await oldClientPeer.shutdown()
}
try {
await stickyPeer.connect()
if (stickyPeer.assignedCellUrl() !== asiaOrigin) {
throw new Error('preferred Asia client did not reach the Asia cell')
}
await waitPastAssignmentRateLimit(scheduleAssignmentRetry)
const reassigned = await stickyPeer.requestAssignment('us-central1')
if (reassigned.cellUrl !== asiaOrigin) {
throw new Error('valid sticky assignment moved after preference changed')
}
} finally {
await stickyPeer.shutdown()
}
return { oldClientUsFirst: true, stickyAssignmentPreserved: true }
}