Skip to content

Conversation

houssain-barouni
Copy link
Collaborator

@houssain-barouni houssain-barouni commented Aug 8, 2025

This pull request refactors the integration tests for both the Elasticsearch and Opensearch exporters to improve test isolation, reliability, and cleanup. The main changes include switching test lifecycle hooks from per-class to per-method, enhancing cleanup routines, and improving template deletion logic to be more targeted and robust.

Test lifecycle and structure improvements:

  • Changed test classes (ElasticsearchExporterIT, OpensearchExporterIT) from using @BeforeAll/@AfterAll and @TestInstance(Lifecycle.PER_CLASS) to @BeforeEach/@AfterEach with the default per-method lifecycle for better test isolation. [1] [2] [3] [4] [5] [6] [7] [8]

  • Moved exporter configuration and opening into each test setup to ensure a fresh exporter state per test. [1] [2]

Cleanup and resource management enhancements:

  • Improved cleanup in @AfterEach to delete indices, index templates, and new component templates, and to close test clients after every test, ensuring no leftover state between tests. [1] [2]

Template deletion logic improvements:

  • Updated deleteIndexTemplates and added deleteComponentTemplates in both TestClient classes to only delete templates matching the current test's index prefix, and to gracefully handle 404 errors when templates do not exist. [1] [2]

Exporter logic adjustment:

  • Removed redundant re-creation of the schemaManager on every configuration change in the Elasticsearch exporter, as it is no longer needed with the new test structure.## Description

Checklist

Related issues

closes #

@github-actions github-actions bot added the component/zeebe Related to the Zeebe component/team label Aug 8, 2025
@houssain-barouni houssain-barouni force-pushed the hb-exporter-flaky-tests branch from ee1f4e5 to 989a175 Compare August 8, 2025 10:37
Comment on lines -73 to -74
// Re-create the schema manager on every configuration change
schemaManager = new ElasticsearchExporterSchemaManager(client, configuration);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this was only required by the previous setup of the IT test

@houssain-barouni houssain-barouni marked this pull request as ready for review August 8, 2025 11:02
@houssain-barouni houssain-barouni requested a review from a team August 8, 2025 11:05
@houssain-barouni houssain-barouni added this pull request to the merge queue Aug 8, 2025
Merged via the queue into main with commit a465944 Aug 8, 2025
101 checks passed
@houssain-barouni houssain-barouni deleted the hb-exporter-flaky-tests branch August 8, 2025 15:24
@houssain-barouni houssain-barouni added the backport stable/8.7 Backport a pull request to stable/8.7 label Aug 8, 2025
@houssain-barouni
Copy link
Collaborator Author

/backport

@backport-action
Copy link
Collaborator

Created backport PR for stable/8.7:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-36602-to-stable/8.7
git worktree add --checkout .worktree/backport-36602-to-stable/8.7 backport-36602-to-stable/8.7
cd .worktree/backport-36602-to-stable/8.7
git reset --hard HEAD^
git cherry-pick -x 989a17581e8a855f4cd5d5030564287c75276be6
git push --force-with-lease

github-merge-queue bot pushed a commit that referenced this pull request Aug 8, 2025
…tests (#36627)

# Description
Backport of #36602 to `stable/8.7`.

relates to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable/8.7 Backport a pull request to stable/8.7 component/zeebe Related to the Zeebe component/team version:8.7.11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants