Commit 2b572716 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Make some tests more robust wrt building with old libvirt

The GetAllDomainStats and ListAllInterfaceAddresses methods
are only available with certain libvirt versions, so we must
cope with an error being raised.
Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
parent f62e64e3
......@@ -1335,6 +1335,10 @@ func TestDomainListAllInterfaceAddresses(t *testing.T) {
ifaces, err := dom.ListAllInterfaceAddresses(0)
if err != nil {
lverr, ok := err.(Error)
if ok && lverr.Code == ERR_NO_SUPPORT {
return
}
t.Fatal(err)
}
......@@ -1363,6 +1367,10 @@ func TestDomainGetAllStats(t *testing.T) {
stats, err := conn.GetAllDomainStats([]*Domain{}, DOMAIN_STATS_STATE|DOMAIN_STATS_CPU_TOTAL|DOMAIN_STATS_INTERFACE|DOMAIN_STATS_BALLOON|DOMAIN_STATS_BLOCK|DOMAIN_STATS_PERF|DOMAIN_STATS_VCPU, 0)
if err != nil {
lverr, ok := err.(Error)
if ok && lverr.Code == ERR_NO_SUPPORT {
return
}
t.Error(err)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment