CeresDB / sqlness

An ergonomic, opinionated framework for SQL integration test.
https://crates.io/crates/sqlness
Apache License 2.0
22 stars 7 forks source link

Another way to compare result file #31

Closed jiacai2050 closed 1 year ago

jiacai2050 commented 1 year ago

Describe This Problem

In current usage pattern, sqlness will write query response to .out file, and it's used to be compared with corresponding .result, while this works for basic case, it becomes verbose when we change some behaviors of server, and lots of .result file need to be updated ONE AFTER ONE.

Proposal

I suggest another pattern to compare result:

Write query result directly to result file

It works like this

I think this usage pattern is more efficient than before.

Additional Context

No response

jiacai2050 commented 1 year ago

@ShiKaiWi @waynexia How do you guys think about this?

waynexia commented 1 year ago

In short, this ticket suggests getting rid of .out file and writing the execution result directly into .result file. Then make use of git to tracking/comparing/reverting the new result, right?

jiacai2050 commented 1 year ago

Exactly

waynexia commented 1 year ago

Makes sense to me 💯 I was trying to find a way to better integrate git and diff into sqlness' workflow, but haven't thought of just dropping .out file and letting git track 🥲.

waynexia commented 1 year ago

save original result file in Vec or tempfile

Do we have to keep the previous result before overwriting? If the diff comes from different behavior of code changes, the original result is likely to be tracked in git.

jiacai2050 commented 1 year ago

Yes, but in some environment there maybe not have git info, such as download src via zip....

I just think git is not a must dependency for sqlness to work.

waynexia commented 1 year ago

Yes, but in some environment there maybe not have git info, such as download src via zip....

I just think git is not a must dependency for sqlness to work.

Great 👍 . Remind me CI is such an environment that doesn't have git.

jiacai2050 commented 1 year ago

😁 I will implement this feature soon.