-
Notifications
You must be signed in to change notification settings - Fork 44
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
refactor: Improve CLI with test suite and builder pattern #928
refactor: Improve CLI with test suite and builder pattern #928
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #928 +/- ##
===========================================
+ Coverage 70.57% 73.15% +2.57%
===========================================
Files 185 185
Lines 17934 18674 +740
===========================================
+ Hits 12657 13661 +1004
+ Misses 4315 3976 -339
- Partials 962 1037 +75
|
bacf80f
to
6334854
Compare
6334854
to
9be4ae4
Compare
73dbdbf
to
5adb176
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.
I gave this a quick look over, skimming over the function internals (will do once mentioned bugs are fixed etc) - I like the structural changes quite a lot and it looks like a nice change overall. Is much much nicer than relying on init
calls.
I am a bit nervous about merging a refactor of the CLI code so much right before the release though, especially given that it is not very well tested compared to stuff like the GQL query system. But I hope we can get this in soon :)
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.
Big fan of the new changes pattern. Will make things much nicer/easier moving forward.
Reviewing this PR highlighted how brittle/poor our client
flow is for consuming. Really need to put together a proper HTTP and GRPC client package, that this can easily consume, instead defining/building everything inline.
But that is entirely independant of this PR work.
Leaving as a comment for now without explicit approve/request change, we can get this merged for 0.5.1 👍
cred := insecure.NewCredentials() | ||
client, err := netclient.NewClient(cfg.Net.RPCAddress, grpc.WithTransportCredentials(cred)) | ||
if err != nil { | ||
return errors.Wrap("failed to create RPC client", err) | ||
} | ||
|
||
rpcTimeoutDuration, err := cfg.Net.RPCTimeoutDuration() | ||
if err != nil { | ||
return errors.Wrap("failed to parse RPC timeout duration", err) | ||
} | ||
|
||
ctx, cancel := context.WithTimeout(cmd.Context(), rpcTimeoutDuration) | ||
defer cancel() |
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.
thought(out of scope): Just adding here to write it down. We should probably pull out the RPC client setup stuff to the root rpc
command and pass the built client over the command.Context object. Will create a followup issue for this.
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.
reminder of this, in case you still want to open the issue
assertContainsSubstring(t, stdout2, `schema type already exists. Name: Post`) | ||
} | ||
|
||
/* disabled because current implementation doesn't support this currently |
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.
todo: remove commented code
Not sure what convention Source is sticking to in terms of commented code but usually it's not a good practice
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 also think this should be removed if not used.
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.
Change look good, but I kinda missed the "builder pattern" part
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
Im rebasing, resolving conflicts, then I'll merge tomorrow |
5dfb279
to
226ab35
Compare
There was a few issues, related to the rootdir, and test commands to run a defradb node goroutine or to run a defra command, which I've fixed in the latest rebase. I suggest this has a last round of review before being merged. |
Is there a specific commit that has those? |
this commit orpheuslummis@ec46190 |
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.
Looks good. Just a few comments that I'd suggest resolving before merge.
assertContainsSubstring(t, stdout2, `schema type already exists. Name: Post`) | ||
} | ||
|
||
/* disabled because current implementation doesn't support this currently |
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 also think this should be removed if not used.
oops, I thought I had removed it. |
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, good work Orpheus :)
8cecd52
to
0983d4f
Compare
Relevant issue(s)
Resolves #593
Description
This introduces the builder pattern, unit tests, integration testing, and removes globals.
Tasks
How has this been tested?
CI
Specify the platform(s) on which this was tested: