Skip to content

[Transform] Stop transforms at the end of tests#139783

Merged
prwhelan merged 8 commits intoelastic:mainfrom
prwhelan:fix/122980
Mar 3, 2026
Merged

[Transform] Stop transforms at the end of tests#139783
prwhelan merged 8 commits intoelastic:mainfrom
prwhelan:fix/122980

Conversation

@prwhelan
Copy link
Copy Markdown
Member

Stopping the transform at the end of test, before the reset, can help other tests running in parallel.

Resolve #122980

Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
@prwhelan prwhelan added >test Issues or PRs that are addressing/adding tests :ml/Transform Transform Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged branch:9.2 branch:9.1 branch:8.19 branch:9.3 labels Dec 18, 2025
@prwhelan prwhelan requested a review from Copilot December 18, 2025 21:14
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 adds cleanup logic to stop transforms at the end of a test method to prevent interference with parallel test execution. The change addresses issue #122980 by ensuring transforms are properly stopped before test cleanup and reset operations.

Key Changes

  • Added explicit stopTransform calls for both the main transform and its clone at the end of the updateTransferRightsTester test method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@prwhelan prwhelan marked this pull request as ready for review January 12, 2026 15:21
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/ml-core (Team:ML)

}, 15, TimeUnit.SECONDS);

stopTransform(transformId, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_1, true, false);
stopTransform(transformIdCloned, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_1, true, false);
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.

No need to deleteTransform?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so? But let's add it just to be safe, it'll keep a consistent pattern across the testing frameworks

@prwhelan prwhelan enabled auto-merge (squash) March 2, 2026 16:33
Copy link
Copy Markdown
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

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

I am not blocking this change, but generally, if you need to do this, you should add an @After teardown type of thing to the tests to clear up any created transforms. Otherwise, if something throws inside the test, the transform will not be cleaned up (idk if we care about this or not).

A common pattern is to have some deque that keeps track of the IDs successfully created and then running through that deque in @After to clear up any created transforms.

@prwhelan
Copy link
Copy Markdown
Member Author

prwhelan commented Mar 2, 2026

I am not blocking this change, but generally, if you need to do this, you should add an @After teardown type of thing to the tests to clear up any created transforms. Otherwise, if something throws inside the test, the transform will not be cleaned up (idk if we care about this or not).

A common pattern is to have some deque that keeps track of the IDs successfully created and then running through that deque in @After to clear up any created transforms.

While I normally agree, given how deprioritized Transforms is generally, I tend to lean towards smaller practical changes that are more likely to be reviewed and merged than broader changes that never get PR'ed. Even this PR took over 3 months.

And if the test fails, there may be other tests complaining about the leaked resource, but the top-most failure is still this test's failure.

@prwhelan prwhelan merged commit 8e67372 into elastic:main Mar 3, 2026
35 checks passed
prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💚 Backport successful

Status Branch Result
9.1
9.3
8.19
9.2

prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
elasticsearchmachine pushed a commit that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve #122980
elasticsearchmachine pushed a commit that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve #122980
GalLalouche pushed a commit to GalLalouche/elasticsearch that referenced this pull request Mar 3, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 3, 2026
…locations

* upstream/main: (51 commits)
  ESQL: Remaining serialization tests (elastic#143470)
  Eagerly release resources in `TransportAwaitClusterStateVersionAppliedAction` (elastic#143477)
  Stop and relocate sliced reindex on shutdown (elastic#143183)
  Documentation for query_vector base64 parameter (elastic#142675)
  ES|QL: Fix LIMIT after all columns are dropped (elastic#143463)
  Update docs-build.yml (elastic#142958)
  Fix KnnIndexTester to work with byte vectors (elastic#143493)
  Fix IndexInputUtils.withSlice to produce native-safe MemorySegments on Java 21 (elastic#143479)
  CPS fix: include only relevant projects in the search response metadata (elastic#143367)
  apm-data: explicit map of timestamp.us to long (elastic#143173)
  [Inference API] Add custom headers for Azure OpenAI Service (elastic#142969)
  ESQL: Add name IDs to golden tests and fix synthetic names (elastic#143450)
  Add getUnavailableShards to BaseBroadcastResponse (elastic#143406)
  Add description to reindex API without sensitive info (elastic#143112)
  SQL: fix CLI tests (elastic#143451)
  ES|QL: Add note of future removal of FORK implicit LIMIT (elastic#143457)
  [Test] Randomly disable doc values skippers in time-series indices (elastic#143389)
  Improve pattern text downgrade license test (elastic#143102)
  [Transform] Stop transforms at the end of tests (elastic#139783)
  Mute org.elasticsearch.compute.lucene.read.ValueSourceReaderTypeConversionTests testLoadAll elastic#143471
  ...
shmuelhanoch pushed a commit to shmuelhanoch/elasticsearch that referenced this pull request Mar 4, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve elastic#122980
elasticsearchmachine pushed a commit that referenced this pull request Mar 9, 2026
Stopping the transform at the end of test, before the reset, can help
other tests running in parallel.

Resolve #122980
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :ml/Transform Transform Team:ML Meta label for the ML team >test Issues or PRs that are addressing/adding tests v8.19.13 v9.1.11 v9.2.7 v9.3.2 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] TransformTaskFailedStateIT testStartFailedTransform failing

5 participants