From e572c2366feb7769d8d8d6c7e77e0f583bcf0c75 Mon Sep 17 00:00:00 2001 From: Ferhat Elmas Date: Wed, 2 Dec 2026 13:11:48 +0100 Subject: [PATCH] chore(acceptance): make imgproxy dev errors env config Signed-off-by: Ferhat Elmas --- .github/workflows/acceptance.yml | 1 + acceptance/README.md | 1 + acceptance/specs/render.test.ts | 23 +++++++++++++++++------ acceptance/support/config.ts | 5 +++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 44e6bc5ec..86ea07414 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -168,6 +168,7 @@ jobs: ACCEPTANCE_ENABLE_VECTOR: ${{ vars.ACCEPTANCE_ENABLE_VECTOR }} ACCEPTANCE_ENABLE_VERSIONING: ${{ vars.ACCEPTANCE_ENABLE_VERSIONING }} ACCEPTANCE_ENABLE_WIRE: ${{ vars.ACCEPTANCE_ENABLE_WIRE }} + ACCEPTANCE_IMGPROXY_DEVELOPMENT_ERRORS_MODE: ${{ vars.ACCEPTANCE_IMGPROXY_DEVELOPMENT_ERRORS_MODE }} ACCEPTANCE_PROFILE: ${{ inputs.profile }} ACCEPTANCE_REGION: ${{ vars.ACCEPTANCE_REGION || secrets.ACCEPTANCE_REGION }} ACCEPTANCE_RESOURCE_PREFIX: ${{ vars.ACCEPTANCE_RESOURCE_PREFIX || secrets.ACCEPTANCE_RESOURCE_PREFIX }} diff --git a/acceptance/README.md b/acceptance/README.md index 6eb75d80d..eca043565 100644 --- a/acceptance/README.md +++ b/acceptance/README.md @@ -158,6 +158,7 @@ secrets as environment secrets. | `ACCEPTANCE_ENABLE_CDN` | Enables CDN purge tests. Managed local runs provide a purge stub by default. | | `ACCEPTANCE_ENABLE_USAGE_CHECKSUM` | Set to `false` to disable the managed-local usage ledger stub and its checksum checks. | | `ACCEPTANCE_ENABLE_RENDER` | Enables image transformation tests. | +| `ACCEPTANCE_IMGPROXY_DEVELOPMENT_ERRORS_MODE` | Whether target imgproxy runs with `IMGPROXY_DEVELOPMENT_ERRORS_MODE=true`. Defaults to `true`; set to `false` when imgproxy v4 runs without dev errors so invalid HEIF probes expect `500` instead of `400`. | | `ACCEPTANCE_ENABLE_RLS_SETUP` | Enables RLS tests; requires service, anon, authenticated keys and bucket/prefix policy resources. | | `ACCEPTANCE_ENABLE_VECTOR` | Enables vector bucket API tests. Requires local pgvector or a configured S3 Vectors target. | | `ACCEPTANCE_ENABLE_VERSIONING` | Enables object versioning and lifecycle configuration tests. Requires `STORAGE_VERSIONING_ENABLED=true` or the multitenant tenant's `objectVersioning` feature; lifecycle configuration also requires migration 79. | diff --git a/acceptance/specs/render.test.ts b/acceptance/specs/render.test.ts index 83237492d..62fc95ba7 100644 --- a/acceptance/specs/render.test.ts +++ b/acceptance/specs/render.test.ts @@ -163,13 +163,24 @@ describeAcceptance( ) ) - expect(rendered.status, rendered.bodyText).toBe(400) expect(rendered.contentType).not.toMatch(/^image\//) - expect(JSON.parse(rendered.bodyText)).toMatchObject({ - error: 'InvalidRequest', - message: 'The source image is invalid or unsupported for rendering', - statusCode: '400', - }) + const payload = JSON.parse(rendered.bodyText) + if (!config.imgProxyDevelopmentErrorsMode) { + expect(rendered.status, rendered.bodyText).toBe(500) + expect(payload).toMatchObject({ + code: 'InternalError', + error: 'InternalError', + message: 'Internal error', + statusCode: '500', + }) + } else { + expect(rendered.status, rendered.bodyText).toBe(400) + expect(payload).toMatchObject({ + error: 'InvalidRequest', + message: 'The source image is invalid or unsupported for rendering', + statusCode: '400', + }) + } } finally { await cleanupRestResources(bucketName, [objectKey], client) } diff --git a/acceptance/support/config.ts b/acceptance/support/config.ts index a8a84d58d..0f2422f3f 100644 --- a/acceptance/support/config.ts +++ b/acceptance/support/config.ts @@ -28,6 +28,7 @@ export interface AcceptanceConfig { capabilities: Record forcePathStyle: boolean forwardedHost?: string + imgProxyDevelopmentErrorsMode: boolean profile: AcceptanceProfile region: string resourcePrefix: string @@ -197,6 +198,10 @@ function buildAcceptanceConfig(): AcceptanceConfig { forwardedHost: optionalTrim( readOption('x-forwarded-host') ?? envOption('ACCEPTANCE_X_FORWARDED_HOST') ), + imgProxyDevelopmentErrorsMode: boolOptionDefaultTrue( + 'imgproxy-development-errors-mode', + envOption('ACCEPTANCE_IMGPROXY_DEVELOPMENT_ERRORS_MODE') + ), profile, region: readOption('region') ?? envOption('ACCEPTANCE_REGION') ?? 'us-east-1', resourcePrefix,