Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: split input/output for planner test #9902

Merged
merged 15 commits into from
May 22, 2023
Merged

test: split input/output for planner test #9902

merged 15 commits into from
May 22, 2023

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented May 18, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

So that we can edit input files painlessly (e.g., no merge conflicts). The output files still contain the inputs for readability, and have exactly the same format as before.

(For reviewer: to confirm output is unchanged, run git diff --stat locally. GitHub is too slow 🤪)

If there are no such changes, it should be good

image

close #8557

The trick is similar to #9787, i.e., make planner tests snapshot testing.

Note: The new result check is simply assert eq the whole file, and produce the diff, instead check test cases one by one.

Limitations

  • In theory the code can be further refactored, but I only made minimal changes to make it work.
  • The error message produced by expect-test isn't optimal (see Panic message is too verbose for large result rust-analyzer/expect-test#39). But since the workflow is mostly just run dapt, and then use external diff tool to review it, it might be acceptable. Alternatively we can fork and improve expecte-test, or use insta instead.

Checklist For Contributors

Checklist For Reviewers

Documentation

  • My PR DOES NOT contain user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

@github-actions github-actions bot added the component/test Test related issue. label May 18, 2023
Copy link
Member Author

Choose a reason for hiding this comment

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

This is for reviewer to play with only

@xxchan xxchan marked this pull request as ready for review May 18, 2023 22:23
@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Merging #9902 (e76d853) into main (7167524) will increase coverage by 0.05%.
The diff coverage is 88.96%.

@@            Coverage Diff             @@
##             main    #9902      +/-   ##
==========================================
+ Coverage   71.09%   71.14%   +0.05%     
==========================================
  Files        1250     1249       -1     
  Lines      209455   209310     -145     
==========================================
+ Hits       148904   148913       +9     
+ Misses      60551    60397     -154     
Flag Coverage Δ
rust 71.14% <88.96%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/frontend/planner_test/src/lib.rs 86.61% <88.43%> (+10.03%) ⬆️
src/frontend/planner_test/src/resolve_id.rs 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@chenzl25 chenzl25 left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Maybe we need to tell developers that apply-planner-test no longer works and we only need do-apply-planner-test.

Copy link
Contributor

@st1page st1page left a comment

Choose a reason for hiding this comment

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

LGTM! So thanks.

@st1page
Copy link
Contributor

st1page commented May 22, 2023

just to confirm, what will happen when some cases panicked? And how a developer can not which case panic in the new framework? In other words, we might need some logic to replace this code.

async fn main() -> Result<()> {
std::panic::set_hook(Box::new(move |e| {
let backtrace = Backtrace::new();
println!(
"{}{}{}{}{}\n{:?}\n{e}",
style("ERROR: ").red().bold(),
style("apply-planner-test").yellow(),
style(" panicked! Try ").red().bold(),
style("run-planner-test --no-fail-fast").yellow(),
style(" to find which test case panicked.").red().bold(),
backtrace,
);
std::process::abort();
}));

Copy link
Contributor

@TennyZhuang TennyZhuang left a comment

Choose a reason for hiding this comment

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

LGTM

TennyZhuang

This comment was marked as duplicate.

@xxchan
Copy link
Member Author

xxchan commented May 22, 2023

just to confirm, what will happen when some cases panicked? And how a developer can not which case panic in the new framework? In other words, we might need some logic to replace this code.

We don't need to handle that now. We used to do it because apply is a separate binary. And it tells you to run run-planner-test (nextest) for debugging. Now we only run nextest which catches panic for us.

@xxchan xxchan enabled auto-merge May 22, 2023 10:44
@xxchan xxchan added this pull request to the merge queue May 22, 2023
Merged via the queue into main with commit f826674 May 22, 2023
@xxchan xxchan deleted the xxchan/planner-test branch May 22, 2023 11:08
Copy link
Member

@stdrc stdrc left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test Test related issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate source file and generated file for parser/planner tests
5 participants