Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions services/cloud-agent-next/src/sandbox-selection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,25 @@ describe('sandbox selection policy', () => {
).not.toContainEqual(getSandboxAllocationRequest('cloudflare-containers-standard-4'));
});

it('fails Cloudflare containers closed for enforced organization billing', () => {
it('offers Cloudflare containers to an enrolled owner under enforced organization billing', () => {
const env = {
...configured,
PER_SESSION_SANDBOX_ORG_IDS: owner.orgId,
CLOUDFLARE_CONTAINERS_ORG_IDS: owner.orgId,
CLOUD_AGENT_CONTAINER_BILLING_ENABLED: 'true',
CLOUD_AGENT_CONTAINER_BILLING_ORG_IDS: owner.orgId,
} as Env;
expect(
getSandboxSelectionCapabilities(env, owner).options.map(option => option.allocation)
).not.toContainEqual(getSandboxAllocationRequest('cloudflare-containers-standard-4'));
expect(() =>
assertSandboxAllocationAvailable(env, owner, 'cloudflare-containers-standard-4')
).toThrow('enforced compute billing');
const capabilities = getSandboxSelectionCapabilities(env, owner);
const options = capabilities.options.map(option => option.allocation);
expect(options).toContainEqual(getSandboxAllocationRequest('cloudflare-containers-standard-3'));
expect(options).toContainEqual(getSandboxAllocationRequest('cloudflare-containers-standard-4'));
expect(capabilities.defaultDestination).toEqual(
getSandboxAllocationRequest('cloudflare-containers-standard-4')
);
expect(options).toContainEqual(capabilities.defaultDestination);
expect(isSandboxAllocationAvailable(capabilities, 'cloudflare-containers-standard-4')).toBe(
true
);
});

it('admits the trigger-only allocation without listing it', () => {
Expand Down
3 changes: 0 additions & 3 deletions services/cloud-agent-next/src/sandbox-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ function sandboxAllocationUnavailableReason(
if (!isCloudflareContainersEnrolled(env, { orgId: owner.orgId })) {
return 'Cloudflare containers are not enabled for this account';
}
if (isCloudAgentContainerBillingEnabled(env, owner)) {
return 'Cloudflare containers do not support enforced compute billing';
}
return undefined;
}

Expand Down