-
Notifications
You must be signed in to change notification settings - Fork 725
Show multiple IP's in list
and info
commands
#1886
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
Codecov Report
@@ Coverage Diff @@
## master #1886 +/- ##
==========================================
+ Coverage 78.46% 78.47% +0.01%
==========================================
Files 234 234
Lines 8768 8856 +88
==========================================
+ Hits 6880 6950 +70
- Misses 1888 1906 +18
Continue to review full report at Codecov.
|
0e9b9cd
to
277d920
Compare
277d920
to
f3d3d4e
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.
Thanks @luis4a0, the approach and code look good! I will do some more testing when reviewing the private side, but everything seems to work well so far.
I have some requests and suggestions for refinement (many are repeated), but the strategy looks solid 😃
tests/qemu/test_qemu_backend.cpp
Outdated
ON_CALL(mock_dnsmasq_server, get_ip_for(_)).WillByDefault([&expected_ip](auto...) { | ||
return mp::optional<mp::IPAddress>{expected_ip}; | ||
}); |
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.
Why the lambda? Should be able to just ....WillByDefault(Return(expected_ip))
.
And might as well EXPECT_CALL, no?
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.
Right, changed the lambda and added the EXPECT_CALL
.
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.
Why did you keep the ON_CALL
though? You have both ON_CALL
and EXPECT_CALL
now.
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.
Just read the difference between them. I was just confused on the meaning of ON_CALL
. Changed.
tests/qemu/test_qemu_backend.cpp
Outdated
mpt::StubVMStatusMonitor stub_monitor; | ||
NiceMock<mpt::MockDNSMasqServer> mock_dnsmasq_server{data_dir.path(), bridge_name, subnet}; | ||
|
||
ON_CALL(mock_dnsmasq_server, get_ip_for(_)).WillByDefault([](auto...) { return mp::optional<mp::IPAddress>{}; }); |
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.
idem: return (with nullopt here) and expect call
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.
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.
idem: {ON,EXPECT}_CALL
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.
f66e6ec
to
f3189ff
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.
Final details inline. You know you can just accept the suggestions (in batches) on GH, right?
src/daemon/daemon.cpp
Outdated
info->set_disk_total( | ||
run_in_vm("df --output=size `awk '$2 == \"/\" { print $1 }' /proc/mounts` -B1 | sed 1d")); | ||
info->set_ipv4(vm->ipv4()); | ||
for (auto extra_ipv4 : all_ipv4) |
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.
for (auto extra_ipv4 : all_ipv4) | |
for (const auto& extra_ipv4 : all_ipv4) |
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.
src/daemon/daemon.cpp
Outdated
if (is_ipv4_valid(management_ip)) | ||
entry->add_ipv4(management_ip); | ||
|
||
for (auto extra_ipv4 : all_ipv4) |
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.
for (auto extra_ipv4 : all_ipv4) | |
for (const auto& extra_ipv4 : all_ipv4) |
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.
tests/qemu/test_qemu_backend.cpp
Outdated
const std::string expected_ip{"10.10.0.35"}; | ||
NiceMock<mpt::MockDNSMasqServer> mock_dnsmasq_server{data_dir.path(), bridge_name, subnet}; | ||
|
||
EXPECT_CALL(mock_dnsmasq_server, get_ip_for(_)).Times(1).WillRepeatedly(Return(expected_ip)); |
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.
EXPECT_CALL(mock_dnsmasq_server, get_ip_for(_)).Times(1).WillRepeatedly(Return(expected_ip)); | |
EXPECT_CALL(mock_dnsmasq_server, get_ip_for(_)).WillOnce(Return(expected_ip)); |
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.
tests/qemu/test_qemu_backend.cpp
Outdated
mpt::StubVMStatusMonitor stub_monitor; | ||
NiceMock<mpt::MockDNSMasqServer> mock_dnsmasq_server{data_dir.path(), bridge_name, subnet}; | ||
|
||
EXPECT_CALL(mock_dnsmasq_server, get_ip_for(_)).Times(1).WillRepeatedly(Return(mp::nullopt)); |
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.
EXPECT_CALL(mock_dnsmasq_server, get_ip_for(_)).Times(1).WillRepeatedly(Return(mp::nullopt)); | |
EXPECT_CALL(mock_dnsmasq_server, get_ip_for(_)).WillOnce(Return(mp::nullopt)); |
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.
Also simplified code of some mock returns.
f3189ff
to
d281627
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.
OK, this is good now, thanks!
bors r+
1886: Show multiple IP's in `list` and `info` commands r=ricab a=luis4a0 This PR adds the ability to gather all the IP's used by each instance. The private bits of this PR are in https://github.com/canonical/multipass-private/pull/338. Co-authored-by: Luis Peñaranda <[email protected]>
Canceling so that this does not go away before rebasing the other side (which will need to merge with this) bors r- |
Canceled. |
Alright, all's good bors r+ |
1886: Show multiple IP's in `list` and `info` commands r=ricab a=luis4a0 This PR adds the ability to gather all the IP's used by each instance. The private bits of this PR are in https://github.com/canonical/multipass-private/pull/338. Co-authored-by: Luis Peñaranda <[email protected]>
Build failed: |
bors retry |
Build failed: |
1886: Show multiple IP's in `list` and `info` commands r=ricab a=luis4a0 This PR adds the ability to gather all the IP's used by each instance. The private bits of this PR are in canonical/multipass-private#338. Co-authored-by: Luis Peñaranda <[email protected]>
This PR adds the ability to gather all the IP's used by each instance.
The private bits of this PR are in https://github.com/canonical/multipass-private/pull/338.