Skip to content

OpenAPI: Support CATALOG_NAME env var in REST fixture#16007

Open
rexminnis wants to merge 2 commits intoapache:mainfrom
rexminnis:fix-14972-rest-fixture-catalog-name
Open

OpenAPI: Support CATALOG_NAME env var in REST fixture#16007
rexminnis wants to merge 2 commits intoapache:mainfrom
rexminnis:fix-14972-rest-fixture-catalog-name

Conversation

@rexminnis
Copy link
Copy Markdown

What changes are included in this PR?

Adds CATALOG_NAME environment variable support to the REST catalog test
fixture, allowing users to override the backend catalog name without the
unintuitive CATALOG_CATALOG_NAME=... form required by the existing
CATALOG_* prefix translation.

  • RESTCatalogServer resolves CATALOG_NAME explicitly before the standard
    property lookup, using putIfAbsent so any caller-provided catalog.name
    property still wins.
  • docker/iceberg-rest-fixture/README.md gains a Configuration section
    documenting CATALOG_NAME and the general CATALOG_* env-var scheme.
  • New RESTCatalogServerTest exercises the helper with 4 cases: env set,
    property-wins-over-env, env missing, env empty.

Closes #14972.

Are these changes tested?

Yes — new RESTCatalogServerTest runs as part of :iceberg-open-api:test.

Are there any user-facing changes?

No behavior change when CATALOG_NAME is unset — default remains
rest_backend. Users can now set -e CATALOG_NAME=mycatalog on the
apache/iceberg-rest-fixture container to change the catalog name served
by the fixture.

The REST catalog test fixture hardcoded catalog_name to "rest_backend",
breaking interop when Trino, PyIceberg, or other engines expected a
different name. The existing CATALOG_* prefix scheme required the
unintuitive CATALOG_CATALOG_NAME=foo to override it.

Adds explicit CATALOG_NAME env var resolution and documents both paths
in docker/iceberg-rest-fixture/README.md. No behavior change when
CATALOG_NAME is unset — default remains "rest_backend".

Adds RESTCatalogServerTest covering set, property-wins-over-env,
missing, and empty env cases.

Closes apache#14972
LOG.info("No warehouse location set. Defaulting to temp location: {}", warehouseLocation);
}

resolveCatalogNameFromEnv(catalogProperties, System.getenv());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change? The catalogProperties comes from RCKUtils.environmentCatalogConfig(). I expect it contains CATALOG_NAME environment variable.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, @ebyhr.

environmentCatalogConfig() turns CATALOG_NAME into the property key name, not catalog.name:

CATALOG_NAME
  → strip "CATALOG_" prefix  → "NAME"
  → "__" → "-"               → "NAME"
  → "_"  → "."               → "NAME"  (no underscores left)
  → lowerCase                → "name"

But RESTCatalogServer reads property catalog.name (CATALOG_NAME constant on line 48 = "catalog.name"). So env CATALOG_NAME=foo ends up as property name, which is ignored, and the backend catalog stays rest_backend.

To set catalog.name via the existing scheme, a user has to set CATALOG_CATALOG_NAME=foo — which #14972 calls out as unintuitive. This PR adds the shorter CATALOG_NAME env var that users naturally try first.

Happy to rework if you'd prefer a different shape — e.g., just documenting CATALOG_CATALOG_NAME without a new code path — but the reporter explicitly asked for a simpler env var.

- Rename RESTCatalogServerTest to TestRESTCatalogServer (repo convention
  per TestClassNamingConvention — Iceberg uses Test prefix, not suffix).
- Use Maps.newHashMap() from the relocated Guava module instead of
  new HashMap<>() (RegexpSingleline rule).

No behavior change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

catalog_name is hardcode in rest fixture, causing interoperability issue (with trino & pyiceberg)

2 participants