After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744098 - test updates for latest libvirt
test updates for latest libvirt
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
3.16.x
Other Linux
: Normal normal
: 3.22
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-02-06 14:34 UTC by vladimir benes
Modified: 2016-03-31 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Load IP from virsh directly (2.30 KB, patch)
2015-02-06 14:40 UTC, vladimir benes
needs-work Details | Review
tests: Load IP from virsh directly (2.34 KB, patch)
2015-02-11 08:51 UTC, vladimir benes
committed Details | Review

Description vladimir benes 2015-02-06 14:34:08 UTC
container for patches
Comment 1 vladimir benes 2015-02-06 14:40:03 UTC
Created attachment 296277 [details] [review]
tests: Load IP from virsh directly

Default.leases file is not present anymore on F22 so we got IPs
from output of virsh net-dhcp-leases.
Comment 2 Zeeshan Ali 2015-02-10 19:28:44 UTC
Review of attachment 296277 [details] [review]:

Good apart from some nitpicks

* F22 -> Fedora 22 (you are upstream now :)) but I think mentioning specific OS is not needed here. Its latest libvirt that has dropped this file.
* Lets mention the actual filename with full path: /var/lib/libvirt/dnsmasq/default.leases.
* Lets enclose commandlines with spaces in `` or ''. i-e 'virsh net-dhcp-leases'.

::: tests/steps/general.py
@@ +121,3 @@
+            if t > time:
+                time = t
+                ips = re.findall( r'[0-9]+(?:\.[0-9]+){3}', line)

redundant space before 'r' above.

@@ +124,3 @@
+
+        if ips:
+            ip = ips[0]

We are assuming first IP is the target one. Since this issue is not introduced by this patch, lets fix that after this patch.
Comment 3 vladimir benes 2015-02-11 08:51:27 UTC
Created attachment 296564 [details] [review]
tests: Load IP from virsh directly

Libvirt project removed /var/lib/libvirt/dnsmasq/default.leases file
so we need to read IP from output of 'virsh net-dhcp-leases' command.
Comment 4 vladimir benes 2015-02-11 09:03:37 UTC
(In reply to Zeeshan Ali (Khattak) from comment #2)
> Review of attachment 296277 [details] [review] [review]:
> 
> Good apart from some nitpicks
> 
> * F22 -> Fedora 22 (you are upstream now :)) but I think mentioning specific
> OS is not needed here. Its latest libvirt that has dropped this file.
> * Lets mention the actual filename with full path:
> /var/lib/libvirt/dnsmasq/default.leases.
> * Lets enclose commandlines with spaces in `` or ''. i-e 'virsh
> net-dhcp-leases'.
> 

altered

> ::: tests/steps/general.py
> @@ +121,3 @@
> +            if t > time:
> +                time = t
> +                ips = re.findall( r'[0-9]+(?:\.[0-9]+){3}', line)
> 
> redundant space before 'r' above.
> 

removed

> @@ +124,3 @@
> +
> +        if ips:
> +            ip = ips[0]
> 
> We are assuming first IP is the target one. Since this issue is not
> introduced by this patch, lets fix that after this patch.

Not taking the first IP. I am taking first IP occurrence (as there is the only one) from the newest line of virsh output (time compared). This has some logic around dealing with previous machines, etc. Working more reliably then the top one before.
Comment 5 Zeeshan Ali 2015-02-11 12:57:54 UTC
(In reply to vladimir benes from comment #4)

Reminder: please use 'Review' link for replying to inline comments.

> > @@ +124,3 @@
> > +
> > +        if ips:
> > +            ip = ips[0]
> > 
> > We are assuming first IP is the target one. Since this issue is not
> > introduced by this patch, lets fix that after this patch.
> 
> Not taking the first IP. I am taking first IP occurrence (as there is the
> only one) from the newest line of virsh output (time compared). This has
> some logic around dealing with previous machines, etc. Working more reliably
> then the top one before.

But its still not checking if the IP is of the right machine or not. It works reliably now but without this check, its likely to break at some point with different test cases.
Comment 6 Zeeshan Ali 2015-02-11 12:59:09 UTC
Review of attachment 296564 [details] [review]:

Looks good.
Comment 7 Zeeshan Ali 2015-02-11 13:20:23 UTC
Attachment 296564 [details] pushed as e55a1f7 - tests: Load IP from virsh directly
Comment 8 vladimir benes 2015-02-11 14:44:11 UTC
(In reply to Zeeshan Ali (Khattak) from comment #5)

> But its still not checking if the IP is of the right machine or not. It
> works reliably now but without this check, its likely to break at some point
> with different test cases.

It finds the latest and tries to ping it. If the latest is already stored (some machine was installed before in the same test) or is unpingable it waits for new one. Finally times out when machine not reachable. Could you tell me what test case can you think about this wouldn't work? I can rewrite it of course a bit. 

Is it possible to match via mac from the same line and machine's xml dump?
Comment 9 Zeeshan Ali 2015-02-11 18:40:44 UTC
(In reply to vladimir benes from comment #8)
> (In reply to Zeeshan Ali (Khattak) from comment #5)
> 
> > But its still not checking if the IP is of the right machine or not. It
> > works reliably now but without this check, its likely to break at some point
> > with different test cases.
> 
> It finds the latest and tries to ping it. If the latest is already stored
> (some machine was installed before in the same test) or is unpingable it
> waits for new one. Finally times out when machine not reachable. Could you
> tell me what test case can you think about this wouldn't work? I can rewrite
> it of course a bit.

Its less about the tests but more about us assuming how libvirt handles this internally (The timing of it). We have test cases already where we have multiple machines running so being the first pingable IP doesn't necessarily mean its of the machine we are interested in.

> Is it possible to match via mac from the same line and machine's xml dump?

Yeah, thats what I had in mind. Get mac from config XML and get the IP against it.