-
Notifications
You must be signed in to change notification settings - Fork 592
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: add data-driven Avro decode integration tests #17434
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f2caca4
to
5f37c9b
Compare
5f37c9b
to
291f561
Compare
let record = build_avro_data(conf.schema.original_schema.as_ref()); | ||
writer.append(record).unwrap(); | ||
let encoded = writer.into_inner().unwrap(); | ||
println!("path = {:?}", e2e_file_path("avro_simple_schema_bin.1")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9f3b8fc
to
3222903
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I didn't really get the motivation. Perhaps @xiangjinwu knows better 😄
async fn test_avro_union_type() { | ||
let parser = new_avro_parser_from_local("union-schema.avsc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this case is not in the new tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. It seems to be missed.
3222903
to
2351718
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
if !f.alternate() || s.len() == 1 { | ||
let (name, ty) = s.iter().next().unwrap(); | ||
return write!(f, "Struct {{ {}: {:?} }}", name, &DataTypeTestDisplay(ty)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we only display the first field of a struct when !f.alternate()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
2351718
to
de77653
Compare
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Background:
This PR proposes to improve the tests with 2 ideas:
Do unit/integration test for encodings.
Logically, these features have a nice clear boundary, there's no reason to start a cluster and write verbose e2e test for them, except we don't have a clear boundary in code. But we are improving the code organization during refactor: split source parser into separate crate #17002, and the test boundary can also be improved now.
Data-driven tests.
Like planner test, execution integration test... We just write input data (instead of using code to generate data). The result can be generated, and displayed in nice human readable format.
Benefits:
UPDATE_EXPECT=1 cargo test -p risingwave_connector_codec
, or use Rust Analyzer toRun test + expect
Limitations:
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.