Skip to content

Add k8s-operator unit tests to PR CI#27387

Merged
pmbrull merged 10 commits intomainfrom
pmbrull/k8s-operator-ci
Apr 15, 2026
Merged

Add k8s-operator unit tests to PR CI#27387
pmbrull merged 10 commits intomainfrom
pmbrull/k8s-operator-ci

Conversation

@pmbrull
Copy link
Copy Markdown
Collaborator

@pmbrull pmbrull commented Apr 15, 2026

Summary

  • Add path-filtered k8s-operator-unit-tests job to the service unit tests workflow
  • Triggers on PRs touching openmetadata-k8s-operator/**
  • Follows the same Detect Changes pattern as the existing service tests
  • Previously, operator tests only ran during manual release builds (docker-k8s-operator.yml)

Test plan

🤖 Generated with Claude Code

The k8s operator tests only ran during manual release builds.
Add a path-filtered job so they run on PRs touching
openmetadata-k8s-operator/**, following the same Detect Changes
pattern used by the service unit tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 15, 2026 08:17
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Apr 15, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a path-filtered CI job to run openmetadata-k8s-operator unit tests on pull requests that touch operator code, aligning it with the existing “Detect Changes” gating used for service unit tests.

Changes:

  • Extend the changes job path filters to detect modifications under openmetadata-k8s-operator/**.
  • Add a new k8s-operator-unit-tests job to run Maven tests for the operator module and publish surefire reports.
  • Include the new job in the workflow’s required-check gate job dependencies.

Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
pmbrull and others added 2 commits April 15, 2026 10:24
…stub

Parent POM surefire includes only match org.openmetadata.service.*,
so operator tests under org.openmetadata.operator.* were silently
skipped. Override with **/*Test.java in the operator pom.xml.

Also remove unused KubernetesClient mock stub from
CronOMJobReconcilerTest.setUp — no test reaches the code path
that calls context.getClient(), causing UnnecessaryStubbingException.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hyphens in output names are parsed as subtraction in GitHub Actions
expressions dot notation, so the job condition would never trigger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 15, 2026 08:25
Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
The replace_all incorrectly changed directory names from
openmetadata-k8s-operator to openmetadata-k8s_operator. Only the
GitHub Actions output key needs the underscore; all file paths must
use the actual hyphenated directory name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
openmetadata-service is a provided-scope dependency, so -am tries
to compile it including shaded ES/OS jars that aren't available in
a clean CI environment. The operator module compiles fine on its own.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
The CSP policy line has unescaped colons inside the value which the
YAML parser interprets as mapping indicators. Use a folded block
scalar (>-) so the value is parsed as a plain string.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 15, 2026 08:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread .github/workflows/openmetadata-service-unit-tests.yml Outdated
Comment thread openmetadata-k8s-operator/pom.xml
Comment thread conf/openmetadata.yaml Outdated
The operator depends on openmetadata-service (provided scope) which
won't be in the Maven cache on a cold CI runner. Build with -am
-DskipTests first, then run operator tests separately — same pattern
as docker-k8s-operator.yml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The reconcile flow is time-dependent — tests using "0 * * * *" can
reach context.getClient() near the top of the hour. Stub the full
client.resources().inNamespace().resource().create() chain as lenient
so early-return tests aren't penalized but happy-path tests won't NPE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 15, 2026 09:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 15, 2026

Code Review ✅ Approved 2 resolved / 2 findings

Unit tests for the k8s-operator are now integrated into PR CI, with the path filtering naming and build caching logic addressed.

✅ 2 resolved
Bug: Path filter uses wrong directory name (underscore vs hyphen)

📄 .github/workflows/openmetadata-service-unit-tests.yml:63-64 📄 .github/workflows/openmetadata-service-unit-tests.yml:154 📄 .github/workflows/openmetadata-service-unit-tests.yml:157 📄 .github/workflows/openmetadata-service-unit-tests.yml:161 📄 .github/workflows/openmetadata-service-unit-tests.yml:164 📄 .github/workflows/openmetadata-service-unit-tests.yml:169
The path filter on line 64 was changed to openmetadata-k8s_operator/**, but the actual directory on disk is openmetadata-k8s-operator/ (with a hyphen). This means the dorny/paths-filter step will never match any changed files under the operator directory, so k8s_operator will always be false for PRs and the tests will never run.

Similarly, the mvn command on line 154 uses -pl openmetadata-k8s_operator but the Maven module directory is openmetadata-k8s-operator, so the build would fail even if the job did trigger.

The same issue affects all hashFiles() and path: references (lines 157, 161, 164, 169) — they all point to a non-existent openmetadata-k8s_operator/ directory.

The rename from hyphen to underscore was only needed for the GitHub Actions output key (since output names don't support hyphens), but it was incorrectly propagated to filesystem paths as well.

Bug: Removing -am may break build when openmetadata-service is not cached

📄 .github/workflows/openmetadata-service-unit-tests.yml:154 📄 openmetadata-k8s-operator/pom.xml:88-93
The openmetadata-k8s-operator pom.xml declares a provided-scope dependency on openmetadata-service (line 88-93). Without the -am (also-make) flag, Maven won't build sibling reactor modules that this module depends on. If openmetadata-service is not already in the runner's ~/.m2 cache, dependency resolution will fail.

The dependency appears unused (no imports from org.openmetadata.service found in the operator source), so you have two options:

  1. Remove the unused dependency from openmetadata-k8s-operator/pom.xml — this is the cleanest fix and lets you keep -am removed.
  2. Restore -am to ensure the dependency is built before the operator tests run.

Option 1 is preferred since the dependency isn't actually used.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions
Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (25 flaky)

✅ 3631 passed · ❌ 0 failed · 🟡 25 flaky · ⏭️ 84 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 478 0 2 4
🟡 Shard 2 642 0 3 7
🟡 Shard 3 645 0 8 1
🟡 Shard 4 619 0 7 22
✅ Shard 5 612 0 0 42
🟡 Shard 6 635 0 5 8
🟡 25 flaky test(s) (passed on retry)
  • Pages/AuditLogs.spec.ts › should apply both User and EntityType filters simultaneously (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/ChangeSummaryBadge.spec.ts › Automated badge should appear on entity description with Automated source (shard 2, 1 retry)
  • Features/DomainTierCertificationVoting.spec.ts › DataProduct - Certification assign, update, and remove (shard 2, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Dashboard (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Pipeline (shard 4, 1 retry)
  • Pages/DomainAdvanced.spec.ts › Domain expert can edit domain description and tags (shard 4, 1 retry)
  • Pages/DomainAdvanced.spec.ts › Filter assets by domain from explore page (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Rename domain with deeply nested subdomains (3+ levels) verifies FQN propagation (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Rename domain with owners and experts preserves assignments (shard 4, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/Lineage/PlatformLineage.spec.ts › Verify domain platform view (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Import ODCS with team owner (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@pmbrull pmbrull merged commit 1dedc0c into main Apr 15, 2026
44 of 45 checks passed
@pmbrull pmbrull deleted the pmbrull/k8s-operator-ci branch April 15, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants