You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "davidzollo (via GitHub)" <gi...@apache.org> on 2026/04/17 06:20:13 UTC
[I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
davidzollo opened a new issue, #10784:
URL: https://github.com/apache/seatunnel/issues/10784
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues) and found no similar feature requirement.
## Background
E2E tests in SeaTunnel are slow. A significant portion of the overhead comes from the fact that **each test class creates and destroys its own `SeaTunnelContainer`** via `ContainerTestingExtension.beforeAll/afterAll`.
The full startup sequence runs for every single test class:
```
ContainerTestingExtension.beforeAll()
→ SeaTunnelContainer.startUp()
→ new GenericContainer(...).start() // Docker cold start: 30–60s
→ waitForLogMessage("received new worker register") // Hazelcast cluster ready
→ copyAllConnectorJarToContainer(...) // copy connector JARs into container
```
On teardown:
```
ContainerTestingExtension.afterAll()
→ SeaTunnelContainer.tearDown()
→ server.close() // container destroyed
```
This means a test suite with 20 test classes pays the 30–60s Docker startup cost **20 times**.
## Proposed Solution
Introduce a **singleton/reusable `SeaTunnelContainer`** that is started once per JVM and shared across all test classes, similar to the [Testcontainers Singleton Pattern](https://java.testcontainers.org/test_framework_integration/manual_lifecycle_control/#singleton-containers).
Key changes required:
### 1. Singleton container lifecycle
Move `SeaTunnelContainer` to a static singleton with a JVM shutdown hook instead of per-class `beforeAll/afterAll`:
```java
class SharedSeaTunnelContainer {
static final SeaTunnelContainer INSTANCE;
static {
INSTANCE = new SeaTunnelContainer();
INSTANCE.startUp();
Runtime.getRuntime().addShutdownHook(new Thread(() -> INSTANCE.tearDown()));
}
}
```
### 2. Connector JAR pre-loading
Currently each test class copies only the connector JARs it needs. With a shared container, all required connectors must be copied **once at startup** (or support hot-copy to the container's connectors directory without restart, since Zeta supports dynamic connector loading).
### 3. Cleanup between test classes
`tearDown` currently deletes the volume and destroys the container. For a shared container, cleanup should only remove per-job artifacts (e.g., volume files written by a specific job), not destroy the container itself.
### 4. Adapt `ContainerTestingExtension`
Change the extension to inject the shared container instance instead of creating a new one in `beforeAll`.
## Key Files
| File | Change needed |
|------|--------------|
| [`SeaTunnelContainer.java`](https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/seatunnel/SeaTunnelContainer.java) | Add singleton pattern, fix `tearDown` to not destroy container |
| [`ContainerTestingExtension.java`](https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/junit/ContainerTestingExtension.java) | Inject shared container instead of creating per-class |
| [`TestSuiteBase.java`](https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/TestSuiteBase.java) | No change expected |
## Expected Impact
- **Before**: N test classes × ~45s Docker startup = N × 45s overhead
- **After**: 1 startup × ~45s + N × ~0s (container already running)
- For a module with 20 test classes: **~15 minutes saved** per CI run
## Non-goals
- This issue does not cover Embedded Zeta or in-process execution
- Streaming/checkpoint E2E tests are still expected to run against the shared container (no scope reduction)
- This does not affect connector-specific external system containers (MySQL, Kafka, etc.), which remain per-class
## Acceptance Criteria
- [ ] `SeaTunnelContainer` can be started once and reused across multiple test classes
- [ ] Connector JARs are loaded at container startup (not per test class)
- [ ] Per-job artifacts are cleaned up between test classes without container restart
- [ ] Existing E2E tests pass without modification to individual test classes
- [ ] CI wall-clock time for at least one E2E module is measurably reduced
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-5015405132
@kuleat Is there any progress for this issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-5086321030
Thanks for volunteering, @goutamadwant. I have assigned the issue to you.
Please keep the first PR conservative. The main goal is to prove that one shared `SeaTunnelContainer` per JVM can reduce repeated startup cost without breaking test isolation. In particular, please make the first slice explicit about:Please keep the first PR conservative. The main goal is to prove that one shared `SeaTunnelContainer` per JVM can reduce recroPlease keep the first PR conservative. The main goal is to prove tent is a good next step.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-5082345552
@DanielLeens would like to get this assigned to me. I have gone through the details and have started something locally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "kuleat (via GitHub)" <gi...@apache.org>.
kuleat commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-5018105364
@davidzollo @DanielLeens Thanks for following up. This issue is more complex than I expected, and I don’t have enough time to finish it. Please unassign me so someone else can work on it. Sorry for the delay.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-5017984899
Thanks for the follow-up here.
@kuleat, this is still a useful improvement, but the issue has been assigned for a while and we do not have an implementation update yet. Could you share whether you are still planning to work on it, and whether anything is currently blocking progress?
If you are still working on it, a short status update or expected timeline would help. If not, that is also fine — we can reopen it for other contributors to pick up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-4292762720
Thanks @kuleat. This is a useful performance improvement to work on.
Please keep the first PR conservative. The main goal should be to reduce repeated container startup cost without changing the actual E2E test semantics. In particular, please make sure the PR covers:
1. a clear shared container lifecycle
2. explicit cleanup between test classes so one test cannot leak files, jobs, or connector state into another test
3. connector jar availability for all tests using the shared container
4. evidence that isolation is preserved, not only that the suite starts faster
If the shared lifecycle turns out to be risky for some test groups, making it opt-in for safe suites first would be better than forcing every E2E test onto the new model in one step.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "kuleat (via GitHub)" <gi...@apache.org>.
kuleat commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-4266182759
Can you please assign me this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][E2E] Make SeaTunnelContainer reusable across test classes to speed up E2E tests [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10784:
URL: https://github.com/apache/seatunnel/issues/10784#issuecomment-5022490567
Thanks for the clear update, and no worries about the delay. I have removed the assignment and kept the issue open with `help wanted` so another contributor can pick it up.
For the next implementation, the safest first step is still an opt-in shared lifecycle for a small E2E module, with explicit cleanup of jobs, files, connector state, and any cross-test resources. Isolation evidence should be treated as an acceptance requirement alongside the wall-clock improvement.
Thank you for taking the time to close the loop so the task is available to the community again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org