villebro opened a new pull request, #2821: URL: https://github.com/apache/datafusion-ballista/pull/2821
# Rationale for this change This is the fourth and last in a series of cleanup PRs that remove duplicated test code, each one shrinking the code base, after #2791, #2800 and #2819. This PR consolidates duplicated test fixtures and helpers of the executor, history, result-service, flight-sql, ballista-cli and chaos-testing crates. It does not add, remove or merge any test. The tests of these crates each repeated small fixtures: the executor and runtime producer setup five times, the same job event records across the history tests, the same `FetchPartition` action in two result-service tests, the executor, job and popup fixtures of two TUI test modules, and the client wiring of the chaos process and k8s runs. This one is more a matter of taste than the earlier PRs. The duplicates are smaller and spread over six crates, so the net saving is modest, and a few changes are judgment calls rather than mechanical moves (listed below). Each crate's change is its own commit, so any part a reviewer would rather not take can be dropped on its own. # Which issue does this PR close? Not related to an issue. The series follows [a review comment on #2765](https://github.com/apache/datafusion-ballista/pull/2765#discussion_r4487993485) pointing out test fixtures copied between test files. # What changes are included in this PR? - executor: a `#[cfg(test)]` `test_util` module with `fresh_runtime_producer` and `test_executor`. - history: `job_start`, `job_index` and `job_end` builders for the event tests. - result-service: `fetch_partition_action` for the unit tests. - flight-sql: the stub backend reuses an executor metadata literal it already had. - ballista-cli: a shared `tui/domain/test_util.rs` with `make_executor`, `make_job`, `make_stage` and `make_popup`. - chaos-testing: `Fixture::connect` (client connect, adaptive planner flag, UDF registration after the connect, table registration), `Fixture::local_sql` and `fixture::query` replace the copies in `ChaosRun` and `K8sRun`. The judgment calls: - The two executor cancellation tests passed the path of a `TempDir` that was dropped at the end of the statement, so the work dir no longer existed while they ran. They now keep the `TempDir` alive. This is the one change that alters what a test runs against, and it is its own commit. - The history builders use one set of timestamps and payloads for every test instead of each test's own literals. No test asserts on those fields. - The TUI app tests' executor now carries two zero-valued metrics, from the shared `make_executor`. Those tests do not read metrics. - `chaos-testing` gains two public items, `Fixture::connect` and `fixture::query`, in a crate that is not published. - New `test_util` modules carry the license header, so the result-service change on its own adds lines. # Testing - `cargo test -p <crate> -- --list` is identical before and after for ballista-executor, ballista-history, ballista-result-service, ballista-flight-sql, ballista-cli and ballista-chaos. - Passing: executor (109), history (23), result-service (12), flight-sql (25, lib and `--test service`), ballista-cli (247). The chaos `ha` scenarios (22) passed on this branch before the merge with `main`; the merged tree is covered by CI. - `cargo fmt --all -- --check`, and clippy with `-D warnings` for these crates (ballista-cli with `cli,tui` and with `web`). - Compiled but not run: the chaos `k8s` tests, which need a kind cluster (`--features k8s`). # Are there any user-facing changes? No. Test code only, plus the two public items in the unpublished `chaos-testing` crate. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
