-
Notifications
You must be signed in to change notification settings - Fork 642
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
[cli] Toggle Primary Instance (petenv) #2102
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.
Hi @surahman, thanks for the PR. I am afraid it doesn't cut it yet though.
The logic for disabling primary would need to go in the commands that deal with it (along with the "if" condition below).
|
Hey @surahman, yeah I mean the places where the primary instance gets special treatment:
They would have to be modified to have the primary instance disabled. Otherwise this just sets the name to the empty string. (Note that, for historic reasons, the code often uses the term |
[tests] mock tests need to be double checked. [utils] handling <"client.primary-name=">. [utils] refactoring. [tests] relocated mock tests to <settings> fixtures. [tests] resetting file. [utils] cleaning up code. [utils] typo with empty string check. [utils] reverting.
@ricab thanks for the information. How would you like to have the For now, I have set a check for disabled |
Hi @surahman, this is quite tricky. if the primary instance is disabled, multipass needs to disable any special treatment for it and error out in commands that need an instance but get none. So, if the user said for instance |
BTW, I haven't looked at your new code yet. Please let me know when you feel it's ready for another review pass. |
Codecov Report
@@ Coverage Diff @@
## main #2102 +/- ##
==========================================
+ Coverage 82.91% 82.98% +0.06%
==========================================
Files 186 186
Lines 9695 9730 +35
==========================================
+ Hits 8039 8074 +35
Misses 1656 1656
Continue to review full report at Codecov.
|
@ricab I have gone ahead and updated the tests to include parameters. ATM The other commands are also set to error out if the I will look through the |
Hmm, I don't quite follow, but primary is an instance that is automatically launched, started, stoped, etc. when you use the corresponding commands without arguments. And its name can change, so that after So, to disable it, EXPECT_CALL(mock_settings, get(Eq(mp::petenv_key))).WillRepeatedly(Return(""));
EXPECT_THAT(send_command({"start" /* no further args */ }), Eq(mp::ReturnCode::CommandFail)); while EXPECT_CALL(mock_settings, get(Eq(mp::petenv_key))).WillRepeatedly(Return("something"));
EXPECT_THAT(send_command({"start" /* no further args */ }), Eq(mp::ReturnCode::CommandSuccess)); The BTW, the help messages are dynamically generated, so you should look for |
My adjustments to const auto custom_petenv = "";
EXPECT_CALL(mock_settings, get(Eq(mp::petenv_key))).WillRepeatedly(Return(custom_petenv));
EXPECT_THAT(send_command({"start"}), Eq(mp::ReturnCode::CommandFail)); For the others, I will need to handle the disabled I will update the descriptions to include behavior for a disabled |
bors try |
tryAlready running a review |
bors try- |
bors try |
bors cancel |
bors try- |
bors try |
tryBuild failed: |
@surahman I believe you have dropped some test code when fixing the conflicts. I didn't want to force-push into your repo (probably couldn't anyway) so I have pushed a fixed merge in the branch primary-null-proposed. You should be able to move this PR to it with the following steps:
|
@ricab sorry about that, thanks for the fix 👍🏽. |
Alright, let's try again. bors try |
tryBuild succeeded: |
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.
Alright, let's merge this. Yeyyy 🥳 Thanks again for your effort getting this done @surahman
bors merge
2102: [cli] Toggle Primary Instance (petenv) r=ricab a=surahman **_Issue #1138:_** I have added support to handle the `client.primary-name=` command. I am not sure about the mock tests I have set up and they would require some review. When stepping through the tests with a debugger I was unable to hit breakpoints on `set` and `set_aux` within the `utils/settings.cpp` file - which is typically an indicator of an issue. Manual argument passing tests work on the `cmdl`. Co-authored-by: Saad Ur Rahman <[email protected]>
@ricab you are most welcome! Thanks for all your patience, guidance, and assistance with this. |
Build failed: |
bors retry |
2102: [cli] Toggle Primary Instance (petenv) r=ricab a=surahman **_Issue #1138:_** I have added support to handle the `client.primary-name=` command. I am not sure about the mock tests I have set up and they would require some review. When stepping through the tests with a debugger I was unable to hit breakpoints on `set` and `set_aux` within the `utils/settings.cpp` file - which is typically an indicator of an issue. Manual argument passing tests work on the `cmdl`. Co-authored-by: Saad Ur Rahman <[email protected]>
Build failed: |
bors retry |
Build succeeded: |
Issue #1138:
I have added support to handle the
client.primary-name=
command. I am not sure about the mock tests I have set up and they would require some review. When stepping through the tests with a debugger I was unable to hit breakpoints onset
andset_aux
within theutils/settings.cpp
file - which is typically an indicator of an issue. Manual argument passing tests work on thecmdl
.