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
fix: only restart if a machine is running #3491
Conversation
67d918e
to
aa66ca3
Compare
findRunningMachine() says it returns a boolean, maybe fix that too? |
Ready for review! 💯 had to figure out what was happening inside the tests and then realized it wasn't being mocked correctly (even for an old test too). Updated and ready 👍 |
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.
Verified on mac and it works for me now. No requests to restart machine if it does not exist or is not started.
disable() and enable() functions can be improved (optional).
LGTM
Thank you for the suggestion @dgolovin ! Totally makes the code a lot cleaner. Pushed your suggestion 👍 |
Unfortunately
As even when it returns undefined in findRunningMachine, promptRestart is still ran in the function: If you replace the code, you'll see that the tests now fail. I've updated the code back to the previous change. |
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.
@dgolovin Ready for another review / I've pushed your changes! :) |
53823cf
to
5128223
Compare
dd07b3a
to
6074e77
Compare
Tests pass now 💯 |
### What does this PR do? No matter what, it would try to restart regardless if a machine was running or not. This is because the if statement was: `if (isRunning !== '')` which will always return true even if isRunning was undefined. The if statement has now been changes to `if (isRunning)` meaning it will only run if isRunning is defined (not ''). ### Screenshot/screencast of this PR <!-- Please include a screenshot or a screencast explaining what is doing this PR --> N/A. The prompt will not appear when trying to restart it if there is no machine running. ### What issues does this PR fix or reference? <!-- Include any related issues from Podman Desktop repository (or from another issue tracker). --> Closes containers#3321 ### How to test this PR? <!-- Please explain steps to reproduce --> Click on Docker Compatibility with a Podman Machine stopped. You should not get the prompt to restart the podman machine. Signed-off-by: Charlie Drage <charlie@charliedrage.com>
fix: only restart if a machine is running
What does this PR do?
No matter what, it would try to restart regardless if a machine was
running or not.
This is because the if statement was:
if (isRunning !== '')
which willalways return true even if isRunning was undefined.
The if statement has now been changes to
if (isRunning)
meaning itwill only run if isRunning is defined (not '').
Screenshot/screencast of this PR
N/A. The prompt will not appear when trying to restart it if there is no
machine running.
What issues does this PR fix or reference?
Closes #3321
How to test this PR?
Click on Docker Compatibility with a Podman Machine stopped. You should
not get the prompt to restart the podman machine.
Signed-off-by: Charlie Drage charlie@charliedrage.com