Skip to content

Fix RequestLatencyTests#27172

Merged
harshach merged 2 commits intomainfrom
fix_tests
Apr 9, 2026
Merged

Fix RequestLatencyTests#27172
harshach merged 2 commits intomainfrom
fix_tests

Conversation

@harshach
Copy link
Copy Markdown
Collaborator

@harshach harshach commented Apr 8, 2026

Describe your changes:

Fixes

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

Summary by Gitar

  • Test isolation fixes:
    • Changed GlossaryOntologyExportIT from CONCURRENT to SAME_THREAD execution to prevent thread pool exhaustion during synchronous Fuseki writes
    • Increased HTTP request timeout in GlossaryOntologyExportIT from 30 to 60 seconds
    • Fixed ConcurrentModificationException in RequestLatencyContextTest by copying registry list before iteration

This will update automatically on new commits.

Copilot AI review requested due to automatic review settings April 8, 2026 14:29
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Apr 8, 2026
manerow
manerow previously approved these changes Apr 8, 2026
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

This PR fixes a flaky/failing unit test setup for request latency metrics by avoiding concurrent modification of Micrometer’s global registry during test initialization.

Changes:

  • Update @BeforeEach registry cleanup to iterate over a snapshot copy of Metrics.globalRegistry.getRegistries() before removing registries.

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 7 comments.

Comment on lines +113 to +115
b.create(
c ->
c.index(indexName)
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

createEntities is documented/used as a create-or-update bulk upsert, but this change switches the bulk op to create, which will skip existing document IDs (409) instead of updating them. This can leave the search index stale for normal re-indexing flows (e.g., SearchRepository.createEntitiesIndex repeatedly indexes the same entity IDs). Consider using index (or update with docAsUpsert) here to preserve upsert semantics; if the intent is truly create-only, the method name/JavaDoc and call sites should be adjusted accordingly.

Suggested change
b.create(
c ->
c.index(indexName)
b.index(
i ->
i.index(indexName)

Copilot uses AI. Check for mistakes.
Comment on lines +147 to +167
if (response.errors()) {
LOG.error(
"Bulk indexing to ElasticSearch encountered errors. Index: {}, Total: {}, Failed: {}",
indexName,
docsAndIds.size(),
response.items().stream().filter(item -> item.error() != null).count());
long realFailures =
response.items().stream()
.filter(item -> item.error() != null && item.status() != 409)
.count();

if (realFailures > 0) {
LOG.error(
"Bulk indexing to ElasticSearch encountered errors. Index: {}, Total: {}, Failed: {}",
indexName,
docsAndIds.size(),
realFailures);
}

response.items().stream()
.filter(item -> item.error() != null)
.forEach(
item -> {
if (SearchIndexRetryQueue.isUuid(item.id())) {
SearchIndexRetryQueue.enqueue(
item.id(),
null,
SearchIndexRetryQueue.failureReason(
"createEntitiesItemError",
new RuntimeException(item.error().reason())));
if (item.status() == 409) {
LOG.debug("Document already exists for ID {}, skipping create", item.id());
} else {
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

When response.errors() is true solely due to 409 conflicts, this branch currently emits no info/warn-level summary (and only debug per-item logs). That makes bulk operations appear to do nothing at default log levels even though documents were skipped. Consider logging a summary count for conflicts (e.g., created vs already-existed) or treating conflict-only responses as a non-error path.

Copilot uses AI. Check for mistakes.
Comment on lines 116 to 120
b.create(
c ->
c.index(indexName)
.id(entry.getKey())
.document(toJsonData(entry.getValue())))));
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

createEntities is documented/used as a create-or-update bulk upsert, but switching the bulk op to create makes indexing idempotent only for new docs and will skip existing IDs with 409 instead of updating them. This risks stale search docs for normal indexing flows (e.g., SearchRepository.createEntitiesIndex re-indexes existing entities/columns). Consider using index (or update with docAsUpsert) to preserve upsert semantics; if create-only is intended, update the method contract and callers accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +169
if (response.errors()) {
LOG.error(
"Bulk indexing to OpenSearch encountered errors. Index: {}, Total: {}, Failed: {}",
indexName,
docsAndIds.size(),
response.items().stream().filter(item -> item.error() != null).count());
long realFailures =
response.items().stream()
.filter(item -> item.error() != null && item.status() != 409)
.count();

if (realFailures > 0) {
LOG.error(
"Bulk indexing to OpenSearch encountered errors. Index: {}, Total: {}, Failed: {}",
indexName,
docsAndIds.size(),
realFailures);
}

response.items().stream()
.filter(item -> item.error() != null)
.forEach(
item -> {
if (SearchIndexRetryQueue.isUuid(item.id())) {
SearchIndexRetryQueue.enqueue(
item.id(),
null,
SearchIndexRetryQueue.failureReason(
"createEntitiesItemError",
new RuntimeException(item.error().reason())));
if (item.status() == 409) {
LOG.debug("Document already exists for ID {}, skipping create", item.id());
} else {
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

When response.errors() is true only because of 409 conflicts, this path does not log any info/warn-level summary (only debug per-item logs). Consider logging a conflict summary (created vs already-existed) or treating conflict-only responses as a non-error to avoid silent skips at default log levels.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +21
new java.util.ArrayList<>(Metrics.globalRegistry.getRegistries())
.forEach(Metrics.globalRegistry::remove);
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

For consistency/readability, prefer importing java.util.ArrayList and using new ArrayList<>(...) (as done in MetricsErrorHandlingTest in the same package) instead of using the fully-qualified new java.util.ArrayList<>(...) inline.

Copilot uses AI. Check for mistakes.
Comment on lines 42 to 43
* <p>Test isolation: Uses TestNamespace for unique entity naming Parallelization: Safe for
* concurrent execution via @Execution(ExecutionMode.CONCURRENT)
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The class JavaDoc still states the test is safe for concurrent execution via @Execution(ExecutionMode.CONCURRENT), but the annotation is now SAME_THREAD. Please update the JavaDoc to reflect the new (non-concurrent) execution mode so future readers understand the constraint.

Suggested change
* <p>Test isolation: Uses TestNamespace for unique entity naming Parallelization: Safe for
* concurrent execution via @Execution(ExecutionMode.CONCURRENT)
* <p>Test isolation: Uses TestNamespace for unique entity naming.
*
* <p>Parallelization: Runs with @Execution(ExecutionMode.SAME_THREAD) and is not intended for
* concurrent execution.

Copilot uses AI. Check for mistakes.
b.index(
i ->
i.index(indexName)
b.create(
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

PR title/description focuses on fixing RequestLatency tests, but this PR also changes bulk indexing behavior for both Elasticsearch and OpenSearch and modifies an integration test’s execution mode/timeout. Please update the PR description/title (or split into separate PRs) so reviewers can assess these search/indexing behavior changes explicitly.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

🔴 Playwright Results — 1 failure(s), 20 flaky

✅ 3597 passed · ❌ 1 failed · 🟡 20 flaky · ⏭️ 207 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 455 0 2 2
🟡 Shard 2 639 0 3 32
🟡 Shard 3 644 0 7 26
🟡 Shard 4 618 0 4 47
🔴 Shard 5 605 1 1 67
🟡 Shard 6 636 0 3 33

Genuine Failures (failed on all attempts)

Pages/Glossary.spec.ts › Add and Remove Assets (shard 5)
�[31mTest timeout of 180000ms exceeded.�[39m
🟡 20 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts › Ml Model - customization should work (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/DataQuality/BundleSuiteBulkOperations.spec.ts › Bulk selection operations (shard 2, 1 retry)
  • Features/DomainTierCertificationVoting.spec.ts › DataProduct - Certification assign, update, and remove (shard 2, 1 retry)
  • Features/LandingPageWidgets/DomainDataProductsWidgets.spec.ts › Assign Widgets (shard 3, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Flow/ExploreDiscovery.spec.ts › Should display deleted assets when showDeleted is checked and deleted is not present in queryFilter (shard 3, 1 retry)
  • Flow/PersonaDeletionUserProfile.spec.ts › User profile loads correctly before and after persona deletion (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 3, 1 retry)
  • Flow/SchemaTable.spec.ts › Copy column link should have valid URL format (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › Enum (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Add, Update custom properties for data product (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Rename domain with subdomains attached verifies subdomain accessibility (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Multiple consecutive domain renames preserve all associations (shard 4, 1 retry)
  • Pages/ExploreTree.spec.ts › Verify Database and Database Schema available in explore tree (shard 5, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/ProfilerConfigurationPage.spec.ts › Non admin user (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

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 9, 2026

Code Review ✅ Approved

Fixes RequestLatencyTests with targeted corrections to test reliability. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@harshach harshach merged commit bf948ac into main Apr 9, 2026
43 of 44 checks passed
@harshach harshach deleted the fix_tests branch April 9, 2026 02:20
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 9, 2026

SaaiAravindhRaja pushed a commit to SaaiAravindhRaja/OpenMetadata that referenced this pull request Apr 12, 2026
SaaiAravindhRaja pushed a commit to SaaiAravindhRaja/OpenMetadata that referenced this pull request Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 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