nzw921rx opened a new issue, #12889: URL: https://github.com/apache/seatunnel/issues/12889
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issue. ### What happened When CI runs a change that only affects the Zeta engine, `RUN_ENGINES` is set to `["zeta"]`. E2E classes annotated with `@DisabledOnContainer(type = {EngineType.SEATUNNEL})` end up with zero containers, but JUnit still executes the test template. `TestCaseInvocationContextProvider` returns an empty stream and every test in the class fails with: ```text org.junit.platform.commons.PreconditionViolationException: None of the supporting TestTemplateInvocationContextProviders [TestCaseInvocationContextProvider] provided a non-empty stream ``` This turns suites that should be skipped into failures. It also runs `@BeforeAll` setup, for example starting the HBase container, even though no test will execute. Examples observed in the CI of PR #12885: - `hbase-connector-it` (JDK 11 and 17) - `transform-v2-it-part-2` (`TestSparkDateTimeTransformIT`) - `all-connectors-it-2` (`IcebergSourceIT`) - `all-connectors-it-6` (`FlinkMetricsIT`) - `mysql-cdc-connector-it` (`MysqlCDCWithFlinkSchemaChangeIT`) ### Root cause - `ContainerUtil.discoverTestContainers()` returns only the containers selected by `RUN_ENGINES`, for example only the Zeta container. - `AnnotationUtil.filterDisabledContainers()` then removes all of them because the test class disables `EngineType.SEATUNNEL`. - `ContainerTestingExtension#beforeAll` stores the empty list. - `TestCaseInvocationContextProvider#provideTestTemplateInvocationContexts` returns `Stream.empty()`. - JUnit 5 requires a `TestTemplateInvocationContextProvider` to provide a non-empty stream, so the class fails instead of being skipped. `@DisabledOnContainer` is a project annotation consumed by `AnnotationUtil`; it is not a JUnit `ExecutionCondition`. JUnit therefore does not skip the class before `@BeforeAll`. ### Expected behavior - If at least one container is discovered, but `@DisabledOnContainer` filters all of them for the test class or method, skip that class or method before `@BeforeAll` runs. - If zero containers are discovered at all, keep failing visibly so a real test-discovery misconfiguration is not hidden. - If at least one applicable container remains, run the suite as before. ### Reproduction Use a Zeta-only engine scope with a suite that is disabled on Zeta, for example: ```bash RUN_ENGINES=zeta ./mvnw -pl :connector-hbase-e2e -am verify \ -DskipUT=true -DskipIT=false -Pci ``` Expected: `HbaseIT` is skipped and the build succeeds. Actual: all 22 `HbaseIT` tests fail with `PreconditionViolationException`. The same reproduction works with `TestSparkDateTimeTransformIT` and `RUN_ENGINES=zeta`, because that class disables `EngineType.SEATUNNEL` and `EngineType.FLINK`. ### Suggested fix Add an `ExecutionCondition` in `seatunnel-e2e-common` that: 1. Discovers the containers selected by `RUN_ENGINES`. 2. Applies `AnnotationUtil.filterDisabledContainers()` to the current class or method. 3. Returns `ConditionEvaluationResult.disabled(...)` when the filtered list is empty. 4. Returns enabled when no containers were discovered, leaving the existing failure visible. Register the condition in `TestSuiteBase` alongside `ContainerTestingExtension`. A defensive guard in `TestCaseInvocationContextProvider` can also handle method-level filters, but the class-level condition is required to prevent `@BeforeAll` from running for a skipped suite. This is test-infrastructure only; no production code, configuration, or data format changes are required. ### SeaTunnel Version `dev` / `3.0.1-SNAPSHOT` ### Java Version JDK 11 and JDK 17 ### Are you willing to submit PR? - [x] 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
