Skip to content

Commit 9a851d6

Browse files
authored
fix: Fix local datafusion-cli test failure (#21761)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> One test case in `datafusion-cli` crate is failing locally if you run all tests through `cargo nextest run`, but passes for `cargo test` ``` FAIL [ 0.375s] datafusion-cli::cli_integration cli_explain_environment_overrides ``` The reason is `nextest` triggers a different build graph, which enforces a feature flag in `serde_json` dependency. This PR enforces this feature in the `dev-dependencies` in `datafusion-cli` crate, so the test become deterministic under different test setup. #21502 Fixed a similar issue, and also explains why not enabling it in the global dependencies inside `Cargo.toml` ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. -->
1 parent 5baa6ef commit 9a851d6

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-cli/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,11 @@ insta = { workspace = true }
7878
insta-cmd = "0.6.0"
7979
rstest = { workspace = true }
8080
testcontainers-modules = { workspace = true, features = ["minio"] }
81+
# Makes sure `test_display_pg_json` behaves in a consistent way regardless of
82+
# feature unification with dependencies
83+
serde_json = { workspace = true, features = ["preserve_order"] }
84+
85+
# Required because we pull serde_json with a feature to get consistent pg display,
86+
# but its not directly used.
87+
[package.metadata.cargo-machete]
88+
ignored = "serde_json"

datafusion-cli/tests/snapshots/cli_explain_environment_overrides@explain_plan_environment_overrides.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ exit_code: 0
1818
| logical_plan | [ |
1919
| | { |
2020
| | "Plan": { |
21-
| | "Expressions": [ |
22-
| | "Int64(123)" |
23-
| | ], |
2421
| | "Node Type": "Projection", |
25-
| | "Output": [ |
22+
| | "Expressions": [ |
2623
| | "Int64(123)" |
2724
| | ], |
2825
| | "Plans": [ |
2926
| | { |
3027
| | "Node Type": "EmptyRelation", |
31-
| | "Output": [], |
32-
| | "Plans": [] |
28+
| | "Plans": [], |
29+
| | "Output": [] |
3330
| | } |
31+
| | ], |
32+
| | "Output": [ |
33+
| | "Int64(123)" |
3434
| | ] |
3535
| | } |
3636
| | } |

0 commit comments

Comments
 (0)