Skip to content

[#14049] improvement(test): Create Kerberos test principals at container start instead of with kadmin in the container - #14094

Draft
nevzheng wants to merge 25 commits into
apache:mainfrom
nevzheng:claude/13900-tc-21-kerberos-principals
Draft

nevzheng wants to merge 25 commits into
apache:mainfrom
nevzheng:claude/13900-tc-21-kerberos-principals

Conversation

@nevzheng

@nevzheng nevzheng commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

What changes were proposed in this pull request?

  • @HiveFixture(kerberosPrincipals = {...}) declares the extra Kerberos principals a test needs; HiveSpec carries them (sorted, de-duplicated), so different principals mean a different container. They need Kerberos auth and a private container (scope = CLASS or METHOD); the fixture fails at class discovery otherwise.
  • The Kerberos Hive container creates them while it starts: a generated script is copied in, and the entrypoint hooks it into the image's start.sh right after the KDC and the image's own principals exist and before HDFS starts, so readiness implies the keytabs exist. A missing hook point or a missing keytab fails the start.
  • HadoopUserAuthenticationIT declares cli_schema and cli_fileset and copies their keytabs out with copyFileFromContainer; its two kadmin.local calls through executeInContainer are gone.

Why are the changes needed?

They were the last commands a test ran inside a container. Until the image adds the principals itself, creating them at start keeps the test free of docker exec.

Fix: #14049

Does this PR introduce any user-facing change?

No. Test code only.

How was this patch tested?

TestHiveSpec (8) and TestHiveContainer (5, including a check that the hook line exists in dev/docker/kerberos-hive/start.sh); :integration-test-common:test (176); HadoopUserAuthenticationIT (4), HDFSKerberosIT, HiveUserAuthenticationIT and MultipleHMSUserAuthenticationIT on Docker.

Stack: #14103 → #14083 → #14084 → #14085 → #14005 → #14006 → #14052 → #14076 → #14007 → #14008 → #14009 → #14010 → #14011 → #14012 → #14013 → #14079 → #14077 → #14078 → #14086 → #14087 → #14088 → #14089 → #14090 → #14091 → #14094

@nevzheng nevzheng self-assigned this Oct 21, 2026
This was referenced Oct 21, 2026
@nevzheng
nevzheng force-pushed the claude/13900-tc-21-kerberos-principals branch 2 times, most recently from 04f29e9 to f2f621c Compare October 21, 2026 21:16
@nevzheng
nevzheng force-pushed the claude/13900-tc-21-kerberos-principals branch 3 times, most recently from 8fc64c9 to f501d92 Compare October 21, 2026 21:40
Design doc for apache#13900 and a rumdl config for design-docs/testing.
…e ContainerSuite lifecycle

- Log every container start with pull, start and readiness times; add test
  log4j configs so the lines show.
- Reset all ContainerSuite state in close(); key Hive by version; make the
  PostgreSQL retry wait; pin StarRocks; drop a dead start method.
- Poll readiness with no initial delay; run cleanDisk() only on real starts.
- idp-basic starts its containers once per run; Ryuk back on, unprivileged.
- Drop the suite-wide closes in Hive2, Flink and Spark ITs.
@nevzheng
nevzheng force-pushed the claude/13900-tc-21-kerberos-principals branch from b0e3887 to 882e073 Compare October 22, 2026 04:29
…est containers (part 1/6)

ContainerSpec, ContainerExtension and @FixtureContainer: a test declares a
container with a fixture annotation and receives it as a parameter or field.
Fixtures for Kafka, LocalStack, RustFS, StarRocks, OceanBase and Doris, with
their callers migrated.
…o, Ranger and Hive (part 2/6)

- TestImages declares every test image in one place.
- BaseContainer subclasses can supply their own container (ready for the
  official Testcontainers modules).
- Moto, Ranger and Hive (version, auth) fixtures.
- A container whose start fails is closed instead of leaking.
…add ClickHouse fixtures and scope (part 3/6)

- client-java, fileset, Hudi, Iceberg, Paimon, Iceberg REST, GVFS, Flink,
  Spark and Trino env tests use @HiveFixture.
- ClickHouse (1 or 3 nodes) and ZooKeeper fixtures.
- scope = RUN | CLASS | METHOD; HadoopUserAuthenticationIT gets a private
  Kerberos Hive.
…and PostgreSQL fixtures (part 4/6)

- Review follow-ups from the first fixture changes.
- A fixture annotation on a field picks that field's container.
- startup = EAGER | LAZY; a warning for fixtures no test injects.
- MySQL and PostgreSQL fixtures; SparkQueryRunner starts Hive through its
  spec.
- Only the run's closer closes the container suite.
- Split container start time into pull, start and readiness; give the Hive
  metastore check a real time budget.
…remaining Hive variants (part 5/6)

- ContainerSpec.dependencies(): dependencies start first, deepest first,
  with a cycle check.
- ClickHouseCluster injected for the three-node cluster.
- Hive auth = RANGER and storage = S3 | GCS | ABS; the CatalogHive IT family
  and the Ranger ITs use them.
- HiveUserAuthenticationIT on the Kerberos Hive fixture.
…th TrinoCluster (part 6/6)

TrinoCluster starts the Trino stack through Testcontainers instead of
launch.sh and docker compose, with real readiness checks and Ryuk cleanup.
@TrinoFixture starts lazily and reads the Gravitino server port from the
test.
…ners per fixture

- durability = DISPOSABLE (default) | DURABLE on every fixture; each
  container applies its own recipe at start.
- Hive keeps HDFS on tmpfs and its metastore MySQL skips per-commit
  flushes, for consistency (no measurable gain on a local Mac); ZooKeeper
  sets forceSync=no; MySQL and PostgreSQL use apache#13899's settings everywhere.
- Ranger keeps its policies in the shared MySQL.
- -PdurableTestContainers makes every container durable, for debugging.

Builds on apache#13899.
…-private shared containers

Every test now gets its containers through a spec. Test classes declare
fixture annotations; code that cannot carry one (BaseIT's Gravitino
backend, which the core database lanes use, idp-basic's backend
parameter, RangerITEnv, SparkQueryRunner) calls Fixtures.get(spec), and
tests that build a container of their own use Fixtures.network().

ContainerSuite becomes the package-private SharedContainers, used only by
specs and ContainerExtension: the same images, environment, host names,
network, one container per key per run, run-end close and timing lines.
Its unused starts (the single Trino container, default Doris and
PostgreSQL overloads) go away; disabled TrinoConnectorIT builds its Trino
container itself. TestContainerSuite becomes TestSharedContainers.
…containers wait strategies

Move the post-start poll loops of Hive, Doris, Ranger, StarRocks, OceanBase,
RustFS, ClickHouse, Kafka and Trino into wait strategies: the port or log check
composed with a ProbeWaitStrategy for checks that need a client. Startup
timeouts are the old port budget plus the old poll budget. Readiness time now
shows in containerMs of the [CONTAINER-TIMING] line.
…nd OceanBase on official Testcontainers modules
…container start instead of with kadmin in the container
@nevzheng
nevzheng force-pushed the claude/13900-tc-21-kerberos-principals branch from 882e073 to 6b16816 Compare October 22, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Subtask] Run test SQL and readiness checks without CLIs in containers

1 participant