new script for migrate max speed APIs dom->migrate_get_max_speed dom->migrate_set_max_speed --- scripts/domain/301-migration-max-speed.t | 64 ++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) create mode 100644 scripts/domain/301-migration-max-speed.t diff --git a/scripts/domain/301-migration-max-speed.t b/scripts/domain/301-migration-max-speed.t new file mode 100644 index 0000000..a07d244 --- /dev/null +++ b/scripts/domain/301-migration-max-speed.t @@ -0,0 +1,64 @@ +# -*- perl -*- +# +# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013 Zhe Peng <zpeng@xxxxxxxxxx> +# +# This program is free software; You can redistribute it and/or modify +# it under the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any +# later version +# +# The file "LICENSE" distributed along with this file provides full +# details of the terms and conditions +# + +=pod + +=head1 NAME + +domain/301-migrate-max-speed.t - test migrate max speed set/get + +=head1 DESCRIPTION + +The test case validates that all following APIs work well include +dom->migrate_get_max_speed +dom->migrate_set_max_speed + +=cut + +use strict; +use warnings; + +use Test::More tests => 5; + +use Sys::Virt::TCK; +use Test::Exception; +use File::stat; + +my $tck = Sys::Virt::TCK->new(); +my $conn = eval { $tck->setup(); }; +BAIL_OUT "failed to setup test harness: $@" if $@; +END { + $tck->cleanup if $tck; +} + +my $xml = $tck->generic_domain("tck")->as_xml; + +my $dom; +ok_domain(sub { $dom = $conn->create_domain($xml) }, "Create domain"); + +diag "Get migrate max speed"; +my $speed = $dom->migrate_get_max_speed(); +ok($speed, "Get migrate max speed $speed"); + +diag "Set migrate max speed"; +$speed = 10000; +lives_ok(sub {$dom->migrate_set_max_speed($speed)}, "Set max speed to $speed"); +my $get_speed = $dom->migrate_get_max_speed(); +is ($speed, $get_speed, "Get speed same as set"); + +diag "Destroy domain"; +$dom->destroy; + +ok_error(sub { $conn->get_domain_by_name("tck") }, "NO_DOMAIN error raised from missing domain", 42); + -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list