-
-
Notifications
You must be signed in to change notification settings - Fork 563
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 identity show
command to use rpc
abstraction and to stop mapping errors manually
#3562
Comments
identity show
command to stop using std::process::exit
and connect_to
identity show
command to use rpc
abstraction and to stop mapping errors manually
Hi, I'd like to contribute to this project. I have a few queries related to this issue:
Thank you for the reply in advance, really appreciate the help. |
Hey @divyank-rs , thanks for showing your interest in the project. Let me answer your questions:
We currently have some tests in place in the You could write a new test for this command checking that it runs successfully. You could also check that the first character of the output equals the IdentityId prefix
Yeah, you can create the requests directly as in the
Don't worry about this. Once you have the Let me know if you need anything else! |
Hey @adrianbenavides , Your advice was really helpful and I've written the code. However upon running the tests, half of them including the |
You don't need to run those, as they test cloud-related functionalities. You can skip them by setting the $ export ORCHESTRATOR_TESTS=1
$ export LONG_TESTS=1 Back to this PR, the $ ockam node delete -af # To delete all your running nodes and start clean
$ ockam node create n1
$ ockam identity show --node n1 |
Hi @adrianbenavides , Thanks a lot for your help. I managed to test it locally by writing a short test in the bats file and it is working as expected. Please let me know if something more is needed from my side. Looking forward to contributing more to the project! |
Hey @adrianbenavides, I've deleted the unused methods as you requested and here is the test I used to verify the
|
Command:
identity show
Current
The current implementation is calling
std::process::exit
, which is something we want to stop using to handle errors properly and give the user a better-formatted output when a command fails.It's also using the
connect_to
function, which can be simplified by using theRpc
utils. Check out how this is done in thesubscription
commands, for example.Desired
run
method (main entry point of the subcommand) should contain a single line of code calling a function (run_impl/rpc/...) that returns acrate::Result<()>
std::process::exit
should not be used manually to map the errors of the command's logicrun
method will return()
. The error will be internally handled within thenode_rpc
functionstd::process::exit
by an actual error, you can use something likeErr(crate::error::Error::new(exitcode::..., anyhow!(...))
rpc
abstraction instead ofconnect_to
You can take the
subscription
commands as a reference.We love helping new contributors!
If you have questions or need help as you work on your first Ockam contribution, please leave a comment on this discussion.
If you're looking for other issues to contribute to, checkout this discussion and labels - good first issue or help wanted
The text was updated successfully, but these errors were encountered: