-
-
Notifications
You must be signed in to change notification settings - Fork 12
run round_trip's assertions in separate threads #53
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
Conversation
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.
I've left some small suggestions for improvements, otherwise this looks fine. Thanks for working on this 👍
|
||
child.kill().unwrap(); | ||
child.wait().unwrap(); | ||
match handler.join() { |
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.
As this is test code it's totally fine to just do a dbg!(handler.join())
here. Cargo does not print output from succeeding tests by default.
So something like dbg!(handler.join()).is_ok()
should be fine.
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.
375c03a uses a closure for two Err(..)
's inside request_test
. Do you still see demand of amendment?
@@ -2,6 +2,7 @@ use crate::database::InferConnection; | |||
use crate::infer_schema_internals::*; | |||
use std::error::Error; | |||
use std::io::Write; | |||
use std::thread; |
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.
Seems like this import is not needed?
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.
Indeed, the import is removed in 375c03a
It looks like I've to improve settings of local |
29ef069
to
98d7d0d
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.
Generally I'm fine with those changes. I've added some small stylistic suggestions how to improve the implementation.
(Sorry for taking some time to do the review, but real life is currently quite time demanding)
@@ -476,6 +476,16 @@ impl<'a> Display for GraphqlInsertable<'a> { | |||
let mut out = PadAdapter::new(f); | |||
writeln!(out)?; | |||
for c in self.table.column_data.iter().filter(|c| !c.has_default) { | |||
let is_pk = self |
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.
I think it would be better to add this as part of the filter expression in the line above?
(I'm not sure why this is even missing. I remember writing similar code there 🙈 )
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.
done in 6c70d55
} | ||
} | ||
|
||
fn request_test(client: &reqwest::Client, listen_url: &str, body: &'static str) -> bool { |
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.
I would prefer to just return a result here and bubble up any potential errors. Then we could just do a t1.is_err()
instead of !t1
in the test above. I think this would make the code much clearer.
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.
Indeed!
|
||
match r { | ||
Ok(mut r) => { | ||
let builder = std::thread::Builder::new().name("round_trip".into()); |
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.
It's better to use std::panic::catch_unwind()
instead here in my opinion. Also this would allow us to just bubble up the "error" in the fail case.
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.
4152b3d contains std::panic::catch_unwind
based approach
This approach ensures the test reachs killing of client's thread.
Is
|
an alternative to previous thread based approach
It was due to default value |
I can't reproduce sqlite test failure locally. I'm still getting the old once for reason
|
Thanks for the changes:+1:
I will try to have a look at the weekend/beginning of the next week
Yes that makes sense. Wundergraph is basically just using the default configs for rustfmt here. I wonder if it could be meaningful to have a rustfmt.toml with default configs in the repo 🤔 |
Co-authored-by: Georg Semmler <[email protected]>
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.
thank you!
+little amemdment in the content
I can't reproduce the new test failure locally. The only failure I get for But |
The sqlite backend does not really support running tests in parallel yet, therefore tests need to be run with |
Single threaded |
This approach ensures the test reachs killing of client's thread.
This commit aims to solve issue #50