Skip to content

refactor(smoke): select the ZDU env through a job folder - #21833

Open
devashish2203 wants to merge 15 commits into
pfp-8945-gradle-zdu-envfrom
pfp-8945-zdu-env-job
Open

devashish2203 wants to merge 15 commits into
pfp-8945-gradle-zdu-envfrom
pfp-8945-zdu-env-job

Conversation

@devashish2203

@devashish2203 devashish2203 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #21832.

What changes

docker/profiles/zdu-test.env becomes the job folder smoke-test/env/zdu/ (one file, all.env, same five keys and values). It has to be all.env, because the old file reached every DataHub service through the ad-hoc DATAHUB_LOCAL_COMMON_ENV slot.

The folder sits with the other smoke job layers under smoke-test/env/. Neither smoke layer reads it: the launcher and the compose job slot read only a job folder's own files and its local/, ci/ and docker/ subfolders, check_env_parity.py reads smoke-test/env/ and smoke-test/env/ci/, and the GMS-lite workflow's smoke-test/env/** path filter excludes smoke-test/env/zdu/**. It is not under smoke-test/tests/, because a folder there without __init__.py fails .github/scripts/check_python_package.py.

  • ZDUTestRunner sets DATAHUB_ENV_JOB_DIR to the absolute folder before its first compose call. Both entry points (python -m tests.zdu.framework and test_zdu_upgrade.py) build the runner, and every compose call inherits the process env. Any job dir already set in the shell is replaced, so ZDU never mixes in another job's values.
  • The METADATA_SERVICE_AUTH_ENABLED=false shell export is removed from _shared.py, rolling_restart.py and nuke_and_redeploy.py. Since refactor(docker): move Gradle spark settings into a job folder #21832, only env/docker/gms.env reads it (${METADATA_SERVICE_AUTH_ENABLED:-true}), and the job all.env sets a literal false later in the same env_file list.
  • Nuke no longer carries DATAHUB_LOCAL_COMMON_ENV through. It only copied the process env value, so removing it changes nothing.
  • Cleanup adds DATAHUB_ENV_JOB_DIR="" (compose treats empty as unset) and keeps DATAHUB_LOCAL_COMMON_ENV=empty.env, so the dev stack goes back to its defaults. It skips the recreate only when GMS runs the original image tag and no longer has ZDU_TEST_FRAMEWORK_ENABLED, a key only the ZDU layer sets: every recreate during the run loads that layer, so the tag alone does not prove the default env.
  • Comments, READMEs, run_test.md, the PDL patch README and env/README.md are updated. A stale upgrade_blocking.py comment that said system-update has no env_file is fixed.

Per-phase compose env, before and after

Process env: before = DATAHUB_LOCAL_COMMON_ENV=zdu-test.env (from the workflow); after = DATAHUB_ENV_JOB_DIR=<repo>/smoke-test/env/zdu (set by the runner).

Phase call Before After
plain docker compose (ps, logs, health) none none
nuke and redeploy (up_stack) old pins + mounts + tokens + DATAHUB_LOCAL_COMMON_ENV + METADATA_SERVICE_AUTH_ENABLED=false old pins + mounts + tokens
prepare old stack (recreate) version + tokens unchanged
rolling restart / shared recreate version + tokens + mounts + METADATA_SERVICE_AUTH_ENABLED=false version + tokens + mounts
system-update one-shot runs update/version + mounts + tokens; -e flags unchanged
cleanup (recreate) version + tokens + DATAHUB_LOCAL_COMMON_ENV=empty.env same + DATAHUB_ENV_JOB_DIR=""

Preflight

Preflight no longer requires DATAHUB_LOCAL_COMMON_ENV, because the runner always supplies the auth bypass. If it is set to anything other than empty.env:

  • The file must exist under docker/profiles/. This catches a leftover zdu-test.env before compose fails with a missing-file error.
  • The file must not set AUTH_POLICIES_ENABLED, REST_API_AUTHORIZATION_ENABLED or METADATA_SERVICE_AUTH_ENABLED to anything but false, and must not list them as bare KEY lines (compose then unsets them). The ad-hoc slot layers over the job slot, so such a line would turn auth back on.

Workflow

.github/workflows/zdu-e2e-daily.yml: one line removed, DATAHUB_LOCAL_COMMON_ENV: zdu-test.env. If it stayed, compose would fail on the deleted file.

Verification

  • Hand-rendered each phase's real compose command and env, before and after, for the debug and debug-consumers topologies. The command is docker compose -f docker-compose.yml -f docker-compose.zdu-test-override.yml config, run once per phase env above, plus cleanup with the job dir unset. Every service's rendered model is identical in all 16 renders. A control run without the job dir does differ, so the check catches real changes.
  • ./gradlew :smoke-test:stackFreePytest: 550 passed.
  • ./gradlew :smoke-test:pythonLint: ruff check and ruff format pass. mypy reports two errors in tests/e2e/knowledge/test_okf_reimport.py, a file this PR does not touch.
  • python3 .github/scripts/check_python_package.py: passes.
  • Compose env snapshot (bare, shell, smoke, AI scenarios), before and after: no differences.
  • ./gradlew :docker:generateQuickstartComposeConfig and git diff --exit-code docker/quickstart/: clean.
  • actionlint on the workflow: clean.

No runtime proof

The daily ZDU workflow does not run on PRs, and no stack was started for this change. All of the evidence above comes from rendered compose models and unit tests. Before merging, run the ZDU daily workflow on this branch manually (workflow_dispatch).

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes (not needed: no effective value changes; only the ZDU test harness is affected)

🤖 Generated with Claude Code


Summary by cubic

Selects the ZDU test environment through a compose job folder (smoke-test/env/zdu/all.env) instead of ad-hoc env slots. The runner sets DATAHUB_ENV_JOB_DIR on every compose call, so the daily workflow no longer passes DATAHUB_LOCAL_COMMON_ENV and phases drop their METADATA_SERVICE_AUTH_ENABLED=false shell exports.

  • docker/profiles/zdu-test.env moves to smoke-test/env/zdu/all.env, next to the other smoke job layers; the GMS-lite workflow's path filter excludes it.
  • Preflight no longer requires DATAHUB_LOCAL_COMMON_ENV; if set, the file must exist and must not set AUTH_POLICIES_ENABLED, REST_API_AUTHORIZATION_ENABLED, or METADATA_SERVICE_AUTH_ENABLED to anything but false — including bare keys, which compose unsets.
  • Cleanup detects the ZDU layer by its ZDU_TEST_FRAMEWORK_ENABLED marker instead of the image tag alone, so it resets the env even when a container recreated during the run already carries the original tag; it clears DATAHUB_ENV_JOB_DIR and keeps DATAHUB_LOCAL_COMMON_ENV=empty.env.
  • The compose env snapshot script sets DATAHUB_ENV_JOB_DIR from the job folder when the tree has one, falling back to the old ad-hoc file for older trees.
  • Verification is limited to rendered compose models and unit tests; the ZDU daily workflow does not run on PRs, so run it manually before merging.

Written for commit fba4dbb. Summary will update on new commits.

View guided diff Turn on auto-fix

docker/profiles/zdu-test.env moves to smoke-test/test_resources/zdu/env/all.env.
The ZDU runner sets DATAHUB_ENV_JOB_DIR to that folder for every compose
call, so the daily workflow no longer passes DATAHUB_LOCAL_COMMON_ENV and
the phases drop their METADATA_SERVICE_AUTH_ENABLED=false shell export:
the job file delivers the same value to the same services. Cleanup clears
the job dir to restore dev defaults. Preflight no longer requires the
ad-hoc file; when one is set it must exist and must not re-enable auth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added devops PR or Issue related to DataHub backend & deployment smoke_test Contains changes related to smoke tests labels Dec 2, 2026
@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
ZDU auth bypass no longer uses the removed docker/profiles/zdu-test.env and workflow DATAHUB_LOCAL_COMMON_ENV=zdu-test.env. The framework now always sets DATAHUB_ENV_JOB_DIR to smoke-test/env/zdu on runner startup so compose loads all.env from that job layer (same bypass keys as before).

Phase compose env drops per-call METADATA_SERVICE_AUTH_ENABLED=false and nuke-time DATAHUB_LOCAL_COMMON_ENV forwarding; auth comes from the job layer’s env_file. Cleanup recreates GMS when ZDU_TEST_FRAMEWORK_ENABLED is still present even if the image tag already matches, and clears DATAHUB_ENV_JOB_DIR plus DATAHUB_LOCAL_COMMON_ENV=empty.env when restoring the dev stack.

Preflight no longer requires the ad-hoc env file; if DATAHUB_LOCAL_COMMON_ENV is set (and not empty.env), it must exist and must not re-enable or unset the three bypass keys. CI/docs drop manual zdu-test.env usage; compose snapshot script and GMS-lite workflow path filters follow the new layout.

Reviewed by Cursor Bugbot for commit 91def69. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Smart test selection

pytest smoke tests

Mode: active. Only the selection below runs for the pytest smoke tests on this PR (applied: smart).

  • Selection: smart: tests for the tagged features, plus always-run modules, this PR's changed tests, and the plumbing sample if the PR changes the pytest harness
  • Size: 26 of 861 tests in 1 batch, predicted longest batch ~0 min
  • Tags: change-type: ci, docs, test-infra, tooling; feature-dev: zero-downtime-upgrade
  • Confidence: HIGH (24 changed files)
  • Classifier reasoning: The change reworks the ZDU test framework and its env job layer (test harness and CI wiring), which maps to zero-downtime-upgrade, while the CI workflows, test harness, docs and .gitignore map to change-type tags.
Selected scopes (7 files or classes, 26 tests)
  • tests/e2e/authorization/test_self_entity_auth.py
  • tests/e2e/delete/delete_assertion_cascade_test.py
  • tests/e2e/frontend/test_static_asset_encodings.py
  • tests/e2e/managed_ingestion/ingestion_source_run_events_test.py
  • tests/e2e/mcp/mcp_test.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection

Add the run-all-tests:pytest label to run the full pytest suite on this PR.

Playwright E2E tests

This run: p0

  • Selection: p0: no spec is tagged zero-downtime-upgrade, so P0 tests plus the tests the change affects
  • Size: 145 tests in 79 spec files, ~32 min predicted on 4 shard(s)
  • Baseline: 79 spec files run for every PR (@p0)
  • No spec was selected because of this PR's changes.

Add the run-all-tests:playwright label to run the full Playwright suite on this PR.

commit fba4dbb · workflow run

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 22 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

devashish2203 and others added 2 commits December 3, 2026 15:04
- preflight: a bare bypass key in the ad-hoc env file also overrides the
  job layer (compose unsets it), so flag it.
- cleanup: don't skip the env reset just because GMS is on the original
  tag; a container recreated during the run still carries the ZDU layer.
- tests: nuke no longer passes DATAHUB_LOCAL_COMMON_ENV; the runner
  selects the job folder and its all.env holds the auth bypass.
- fix two inaccurate comments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	.gitignore
devashish2203 and others added 3 commits December 3, 2026 19:38
Every smoke job layer now sits under smoke-test/env/. The folder holds
the same all.env; the framework still selects it itself. The Docker-free
and Docker smoke layers never read the zdu/ subfolder, and the GMS-lite
workflow's smoke-test/env/** path filter now excludes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	env/README.md

@david-leifker david-leifker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — fba4dbb2 Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops PR or Issue related to DataHub backend & deployment smoke_test Contains changes related to smoke tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants