8000 test(e2e): add OSS 3P ClickHouse and Redpanda Kind E2E integration suite by VLukiantsev · Pull Request #1105 · google/xmc · GitHub
[go: up one dir, main page]

Skip to content

test(e2e): add OSS 3P ClickHouse and Redpanda Kind E2E integration suite - #1105

Merged
VLukiantsev merged 3 commits into
mainfrom
feat/components-oss-3p-e2e-suite-b548436596
Oct 7, 2026
Merged

VLukiantsev merged 3 commits into
mainfrom
feat/components-oss-3p-e2e-suite-b548436596

Conversation

@VLukiantsev
Copy link
Copy Markdown
Collaborator

Summary

Implements the OSS 3P ClickHouse and Redpanda end-to-end integration test suite on ephemeral KinD clusters (test/e2e/clickhouse_3p_test.go, test/e2e/redpanda_3p_test.go, and test/e2e/kind_3p_harness_test.go). The suite verifies xmc-bridge status discovery, active health probing, .status.access.envVars projection, typed Go component resolvers, and live data-plane connectivity from mock ML workload Pods.

Motivation & Context

As part of the XMC Components architecture, third-party infrastructure services (ClickHouse and Redpanda) can be integrated via either an Operator-Managed wrapperRef CR (ClickHouseInstallation / Redpanda Cluster) or the stable-2026a Operator-less profile (spec.parameters with active endpoint probing). This E2E suite validates both reconciliation paths end-to-end against real ClickHouse and Redpanda instances inside an isolated KinD cluster and confirms that downstream ML workload Pods can execute SQL queries and publish/consume Kafka messages using the injected connection parameters.

Key Changes

  • KinD 3P Component E2E Harness (test/e2e/kind_3p_harness_test.go):
    • Provisions an isolated ephemeral KinD cluster with automatic t.Cleanup teardown (or reuses KIND_CLUSTER_NAME when created via tools/dev_env/dev_env.py), preloads container images, and installs the components.xmc.dev CRD.
    • Runs xmc-bridge (bridge.NewReconciler) wired to an in-process cms.NewServer(store.NewMemoryStore()), bridge.NewK8sStatusDetector, and a kindNodePortProber (bridge.HealthProber) that translates <svc>.<ns>.svc.cluster.local:<port> to <kindNodeInternalIP>:<nodePort> for live TCP/HTTP readiness probing.
    • Provides runMockMLWorkloadPod to spawn mock ML workload Pods injected with .status.access.envVars and SecretKeySelector credentials and capture container logs upon PodSucceeded.
    • Includes hermetic unit tests (TestKind3PHarnessUnit) covering GVR mapping, NodePort endpoint translation, and CRD/Component readiness predicates.
  • ClickHouse 3P E2E Test (test/e2e/clickhouse_3p_test.go):
    • Deploys the clickhouseinstallations.clickhouse.altinity.com CRD, credentials Secret, and a single-node clickhouse/clickhouse-server:24.3-alpine instance in KinD.
    • Exercises both OperatorManagedWrapperRef and OperatorlessStable2026aProfile modes, asserting Ready=True, .status.access.envVars, componentconfig.ResolveOptions resolution, and live CREATE TABLE / INSERT / SELECT execution from a mock ML workload Pod.
  • Redpanda 3P E2E Test (test/e2e/redpanda_3p_test.go):
    • Deploys the clusters.cluster.redpanda.com CRD, credentials Secret, and a single-node docker.redpanda.com/redpandadata/redpanda:v24.1.1 broker in KinD.
    • Exercises both OperatorManagedWrapperRef and OperatorlessStable2026aProfile modes, asserting Ready=True, .status.access.envVars, ingestiongateway.ResolveRedpandaComponentConfig resolution, and live Kafka topic creation, message production, and consumption via rpk from a mock ML workload Pod.
  • Build & Documentation (test/e2e/BUILD.bazel, test/e2e/README.md, cmd/ingestion_gateway/ingestiongateway/BUILD.bazel):
    • Added kind_3p_harness_unit_test, clickhouse_3p_test, and redpanda_3p_test Bazel test targets and documented CLI execution commands.

Assumptions

  • enable_components Deployment Flag Scope:
    • Behavior with enable_components=true: The components.xmc.dev CRD and xmc-bridge controller are active; Component CRs (clickhouse, redpanda) are reconciled, probed for endpoint readiness, and projected with .status.access.envVars for workload pod injection and typed component config resolution.
    • Behavior with enable_components=false: The components.xmc.dev CRD and xmc-bridge controller are not deployed by the umbrella chart, and component resolvers fall back to legacy CLI flags/environment variables.
    • Verified live: enable_components=true equivalent (live components.xmc.dev CRD + xmc-bridge reconciler + ClickHouse and Redpanda Component CRs verified end-to-end in an ephemeral KinD cluster).
  • Single-Node ClickHouse & Redpanda Instances Under 3P Operator CRs in KinD:
    • Rather than pulling full upstream operator controllers and cert-manager from external URLs during ephemeral KinD runs, the E2E suite installs the clickhouseinstallations.clickhouse.altinity.com and clusters.cluster.redpanda.com CRDs alongside real single-node ClickHouse (clickhouse/clickhouse-server:24.3-alpine) and Redpanda (docker.redpanda.com/redpandadata/redpanda:v24.1.1) Pods/Services — assumed to prevent network/webhook flakiness while exercising xmc-bridge K8sStatusDetector JSONPath discovery, active TCP/HTTP health probing, and real SQL/Kafka data-plane execution — if full upstream operator controller reconciliation is additionally needed, a separate nightly operator-lifecycle test would be required.

Verification & Testing

  • Commands Executed:
    • bazel test //test/e2e:kind_3p_harness_unit_test //pkg/components/... //pkg/clickhouse/... //cmd/ingestion_gateway/...
    • bazel test //test/e2e:clickhouse_3p_test //test/e2e:redpanda_3p_test --test_output=streamed --test_arg=-test.v
    • ./.githooks/pre-commit
    • ./tools/analyze_diff_size.py --base-ref origin/main
  • Coverage & Test Status:
    • All 15 hermetic unit test targets (//test/e2e:kind_3p_harness_unit_test, //pkg/components/..., //pkg/clickhouse/..., //cmd/ingestion_gateway/...) passed.
    • Both live KinD E2E suites (//test/e2e:clickhouse_3p_test and //test/e2e:redpanda_3p_test) passed end-to-end in both isolated ephemeral KinD cluster mode and KIND_CLUSTER_NAME cluster-reuse mode.
    • Diff size is within single-PR thresholds (prod_code_lines: 1, test_code_lines: 984, total_code_lines: 985, doc_lines: 26).

Related Issues / Bugs

Fixes bug 548436596

TAG=agy
CONV=6bc68b62-40f7-4652-8de6-f5a036d676b2

Implement the end-to-end integration test suite for OSS 3P ClickHouse
and Redpanda components on ephemeral KinD clusters (`test/e2e/clickhouse_3p_test.go`,
`test/e2e/redpanda_3p_test.go`, and `test/e2e/kind_3p_harness_test.go`):

- Provision an isolated ephemeral KinD cluster with automatic cleanup
  (or reuse `KIND_CLUSTER_NAME` when provided via `dev_env.py`), install
  the production `components.xmc.dev` CRD and 3P operator CRDs
  (`clickhouseinstallations.clickhouse.altinity.com` and
  `clusters.cluster.redpanda.com`), and start `xmc-bridge` backed by an
  in-memory `ComponentManagerService` (CMS) and NodePort health prober.
- Verify both Operator-Managed (`spec.wrapperRef`) and Operator-less
  (`stable-2026a` `spec.parameters`) reconciliation modes project
  `Ready=True`, `state=COMPONENT_STATE_ENABLED`, `observedGeneration`,
  and `.status.access.envVars` (`ENDPOINT`, `HOST`, `PORT`,
  `SECRET_NAME`).
- Validate typed Go component resolvers (`componentconfig.ResolveOptions`
  and `ingestiongateway.ResolveRedpandaComponentConfig`) against live
  Kubernetes `Component` CRs and Secrets.
- Spawn mock ML workload Pods injected with `.status.access.envVars` to
  execute SQL queries (`CREATE TABLE`, `INSERT`, `SELECT`) against live
  ClickHouse and publish/consume Kafka messages via `rpk` against live
  Redpanda.

Fixes bug 548436596

TAG=agy
CONV=6bc68b62-40f7-4652-8de6-f5a036d676b2
@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces standalone Go KinD integration test suites for ClickHouse and Redpanda 3P components, along with a shared test harness (kind_3p_harness_test.go) that provisions ephemeral KinD clusters, deploys mock workloads, and handles NodePort-based health probing. The review feedback highlights several critical improvements for the test harness to ensure reliability and safety in parallel CI environments. These include avoiding broad home directory globbing when resolving binary paths, using full UnixNano() values to prevent cluster and namespace name collisions, making the wait loop context-aware to avoid blocking on cancellation, and limiting the log reader size to prevent out-of-memory crashes. Additionally, a defensive nil check is recommended in the ClickHouse test to prevent potential panics when resolving component options.

Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/clickhouse_3p_test.go Resolved
Address automated code review feedback on PR #1105:
- Replace home directory globbing in `resolveBinaryPath` with
  `os.UserHomeDir()` (`~/.local/bin`) and `/usr/local/bin`.
- Remove modulo truncation on `time.Now().UnixNano()` when generating
  unique KinD cluster and test namespace names.
- Make `waitUntil` immediately responsive to context cancellation using
  `time.NewTicker` and `select` on `ctx.Done()`.
- Cap pod log reads in `fetchPodLogs` using `io.LimitReader` (1 MiB).
- Add defensive `opts == nil` check in `assertClickHouseComponentResolver`.

Comment link: #1105 (comment)
Comment link: #1105 (comment)
Comment link: #1105 (comment)
Comment link: #1105 (comment)
Comment link: #1105 (comment)
Comment link: #1105 (comment)

TAG=agy
CONV=6bc68b62-40f7-4652-8de6-f5a036d676b2
@VLukiantsev
VLukiantsev requested a review from janzak-dev October 7, 2026 08:53
@VLukiantsev
VLukiantsev marked this pull request as ready for review October 7, 2026 08:54
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
Comment thread test/e2e/kind_3p_harness_test.go Resolved
…tTimeout in KinD 3P harness

Address actionable review feedback on PR #1105:
- Render `deploy/helm/templates/components/crd.yaml` via `helm template`
  instead of manual `{{-` line stripping (`installComponentCRD`).
- Clear finalizers and poll until `apierrors.IsNotFound` when resetting
  the `Component` CR between subtests (`applyThirdPartyComponentCR`).
- Remove redundant asynchronous Pod `Delete` before `Create` in
  `runMockMLWorkloadPod` (each subtest uses a distinct pod name).
- Delegate `waitUntil` to `k8s.io/apimachinery/pkg/util/wait.PollUntilContextTimeout`.
- Derive user `~/.local/bin` fallback in `resolveBinaryPath` when Bazel
  strips `$HOME`.

Comment link: #1105 (comment)
Comment link: #1105 (comment)
Comment link: #1105 (comment)
Comment link: #1105 (comment)

TAG=agy
CONV=6bc68b62-40f7-4652-8de6-f5a036d676b2
@VLukiantsev
VLukiantsev requested a review from janzak-dev October 7, 2026 10:05
@VLukiantsev
VLukiantsev added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit 720873e Oct 7, 2026
11 checks passed
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.

2 participants

0